Browse Source

Documentation fix.

master
Greg 2 years ago
parent
commit
a463c073ed
  1. 11
      README.md

11
README.md

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

Loading…
Cancel
Save