-
Notifications
You must be signed in to change notification settings - Fork 0
ComboBox
Wire name combobox
A collapsed list: one visible value, a drop-down of choices, optionally typeable.
c=new combobox children={
new item caption="Small"
new item caption="Medium"
new item caption="Large"
} selected=1
| Property | Type | Default | Meaning |
|---|---|---|---|
editable |
flag | false |
Allow typing a custom value. |
max_visible |
int | — | Max dropdown rows shown. |
placeholder |
string | — | Empty-field hint text. |
selected |
int | -1 |
Selected index (-1 = none). |
Plus the common properties.
Choices are children of the shared virtual item type, the same one
ListView and TreeView use. Items cannot nest here.
change — The selection changed.
| Field | Type | Meaning |
|---|---|---|
trinket |
uint | The combo box's object ID. |
selected |
int | Index of the newly selected item, or -1 for none. |
There is no separate "opened" or "closed" event — the drop-down is the trinket's own affair, and only the resulting selection crosses the wire.
The same ordering rule as ListView, failing the same silent way:
new combobox selected=1 children={new item caption="A"; new item caption="B"}
-> selected = 0
new combobox children={new item caption="A"; new item caption="B"} selected=1
-> selected = 1
Write children first — or declare a template
carrying the choices, which applies them before any instance property and so
takes the ordering out of each caller's hands.
editable lets the user type a value instead of only choosing one, and
placeholder is the hint shown while the field is empty — the same role it
plays on TextInput.
An editable combo box is two things at once: a list to pick from and a field
to type in. The change event reports the selected index, so a typed
value that matches nothing in the list has no index to report. If free text
matters to your application, read it from the field rather than inferring it
from the selection.
max_visible caps how many rows the drop-down shows before it scrolls. It is
a row count, not a size in units — the one property here
that is not.
| Does | |
|---|---|
Up Down
|
Move through the choices. |
Return |
Accept the highlighted choice, closing the drop-down. |
Esc |
Close without changing the selection. |
| Click | Open the drop-down; click a row to choose it. |
It takes focus by Tab and by click.
ListView — the same choices, always visible · RadioButton — the same choices, all visible at once · TextInput · Common Properties
KittyTK — image/tty Trinket Kit · MIT licensed · alpha, 0.1.x
Repository · Issues · Support on ko-fi
Sibling projects: PurfecTerm (terminal emulator) · mew (text editor) · PawScript (language)
Getting Started
Installation Building from Source Running a Display Host Your First Application Examples
Protocol
Protocol Overview Object Model Properties and Values Events Templates and Aliases Common Properties Introspection Transports and Security
Clients
Go Client Python Client C Client
Application Objects
Application · MenuBar · Window · MessageBox
Output Trinkets
Label · ProgressBar · StatusBar
Input Trinkets
TextInput · Editor · Terminal
Button · CheckBox · RadioButton
ListView · ComboBox · TreeView
Layout Trinkets
TabTrinket · Panel
ScrollArea · MDIPane
Separator · Spacer · Splitter
Other Trinkets
Layout Helpers