mirror of https://github.com/mum4k/termdash.git
Updated Container API (markdown)
parent
468c315e51
commit
46bb076227
|
@ -108,6 +108,34 @@ of the container unless the container has padding specified.
|
|||
|
||||
The **container.PlaceWidget** option places the provided widget into the container.
|
||||
|
||||
[[/images/container-api/placed_button.gif|placed_button]]
|
||||
|
||||
The following code places a button widget inside a container as shown above:
|
||||
|
||||
```go
|
||||
tb, err := termbox.New()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer tb.Close()
|
||||
|
||||
b, err := button.New("hello world", func() error {
|
||||
return nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := container.New(
|
||||
t,
|
||||
container.PlaceWidget(b),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
### Widget alignment options
|
||||
|
||||
The following options can be used to align a widget within the container both
|
||||
|
|
Loading…
Reference in New Issue