Hands-On GUI Application Development in Go
上QQ阅读APP看书,第一时间看更新

Widgets

The remaining widgets will be familiar to to any developer of desktop graphical applications, or indeed anyone who uses them. Provided here is a quick overview for the features or limitations of each:

  • Button: A standard pushbutton with a label, and an onClicked callback
    • Checkbox: A toggled entry that is either checked or unchecked; an onToggled callback will trigger on change
  • Combobox: A widget that provides a list of strings to select from
  • DateTimePicker: A field for entering date and/or timethe configuration is set by different constructor functions
  • Entry: A single-line text-entry widget, which can be read-only; it supports an onChanged handler for change events
  • Label: A simple read-only text component for annotating the user interface
  • ProgressBar: A horizontal bar to indicate progress; values range from 0 to 100
  • RadioButtons: A control for presenting a list of options, such as check boxes, but where only one can be selected
  • Separator: A horizontal or vertical line to visually separate other controls
  • Slider: A horizontal bar for selecting between the set min and max integer values by moving an indicator
  • Spinbox: An entry box for selecting an integer between the min and max values with the up and down buttons

A noticeable omission on this list is menu or toolbar widgets; they are not included in andlabs UI toolkit at the time of writing. Next, we'll look at a potential workaround for menus (which unfortunately will not work for a toolbar) by accessing the underlying libui.