Appendix F - Grouping Input Widgets by Data Type

Every widget in a GUI toolkit either displays a value or lets the user edit one (or both). This appendix groups input widgets by the data type they produce.

Books and tutorials on GUI programming, and visual GUI design tools (such as Qt Designer) mostly group widgets by appearance, function, layout role, or high-level purpose, putting input widgets in a single group. But when choosing a widget, the question you need to answer is “what type of value do I need to capture?” If you know the type, you know which widget to use. Organizing widgets by data type makes this explicit.

Category Produced / consumed type Typical widgets
Action / Void None (triggers behavior) Button, Icon Button, Menu Item, Toolbar Button
Boolean bool Checkbox, Switch, Toggle Button
Integer int Spin Box, Integer Slider, Dial
Float float Double Spin Box
String str Line edit, Text Area
Rich text Formatted text (HTML, Markdown) Rich Text Editor, WYSIWYG Editor
Enum(Single) One value from a fixed set Dropdown, Combo Box, Radio Group
Enum(Multi/Bitmask) Multiple values from a fixed set Checkbox Group
Temporal date, time, datetime, timedelta Date Picker, Time Picker, DateTime Picker
Sequence/List list or set of items List view, Tag/Chip Input
Record/Struct dataclass, named tuple, struct Form, Fieldset, Property Sheet
Map/Dictionary dict Key-Value Editor
Table/Grid 2-dimensional data Table View, Data Grid
Tree Hierarchical structure Tree View

Many widgets can handle more than one type. For example, a spin box can work with both int and float. A dropdown can represent a string or an enum.

A single checkbox maps to Boolean. A group of checkboxes maps to a bitmask.

Records are typically implemented as groups of simpler widgets rather than single widgets.