Version: v0.0.0-...-b8644d8 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2021 License: Unlicense Imports: 6 Imported by: 0


Count – a simple Counter

UI for a simple counter

This little example is mainly about exploring a way of expressing the visual representation in a more concise way.

Building the View Tree

Gio is very flexible and it is possible to do anything related to UI graphics with it. However, building the visual tree assembles nested objects and function calls (often closures), which quickly becomes tedious.

One way of simplifying nested function calls is to make is possible to chain them. So instead of

    var my DomainObject

    Layout(context) dimensions {
        property1 := …
        container{axis: V}.Layout(context, property1) {
            widget1(context, &my),
            func(context) dimensions {
                property2 := …
                text := "…"
                return widget2(context, property2, text)

we may prefer typing something like this:

    var my DomainObject


(Both snippets in pseudo-code.)

Making it easier for users to create the widget tree requires reducing complexity by reducing options. It is necessary to strike a balance between flexibility and expressiveness. The HTML/CSS model is widely used and may be an adequate set of functionality. A requirement is, however, to always make it easy to opt out and fall back to Gio's full capacity.


The counter box is a user-level component. It encapsulates widget behaviour and visuals in one place. Its interface is provided by a UI delegate binding to the domain object (a simple int in this case).


The Go Gopher

There is no documentation for this package.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL