diff --git a/README.md b/README.md index 34628a5..4c77565 100644 --- a/README.md +++ b/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 }) }