Updated Container API (markdown)

Jakub Sobon 2019-03-02 23:17:50 -05:00
parent 468c315e51
commit 46bb076227
1 changed files with 28 additions and 0 deletions

@ -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