Documentation fix.

This commit is contained in:
Greg 2019-08-16 20:31:50 -04:00
parent bfd6ae49df
commit a463c073ed
1 changed files with 7 additions and 4 deletions

View File

@ -32,9 +32,12 @@ type Enclosure interface {
func Enclose(e Enclosure, w ...Widget) Widget { ... }
```
The `Context` struct also contains a `map[string]interface{}` allowing arbitrary
data to be maintained. This can be used, for example, to define themes, and control
the operation of a `WidgetCombinator` during operation. For example>
The giowrap package also includes a private package-global variable called
extra that is a []interface{}, allowing arbitrary data to be maintained by
UI elements. Elements can request access to the structure when they are
allocated and they are returned a unique integer index into the slice. This
can be used, for example, to define themes, and control
the operation of a `WidgetCombinator` during operation. For example:
```go
type fWidget struct { l Layout }
@ -42,7 +45,7 @@ func NewfWidget(l layout) fWidget { return fWidget{ l: l } }
func Flexible(v float32) Widget {
return NewfWidget(func(ctx Context) Context {
ctx.extra["Flexible"] = v
extra.data[extra.cur].(*FlexOpts).flexible = v
return ctx
})
}