list-box% : class? | ||
superclass: object% | ||
|
Whenever the user changes the selection in a list box, the list box’s callback procedure is called. A callback procedure is provided as an initialization argument when each list box is created.
List box items are indexed from 0.
See also choice%.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
→ (is-a?/c list-box%) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label : (or/c label-string? false/c) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
choices : (listof label-string?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
selection : (or/c exact-nonnegative-integer? false/c) = #f | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
font : (is-a?/c font%) = view-control-font | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label-font : (is-a?/c font%) = normal-control-font | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
enabled : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vert-margin : (integer-in 0 1000) = 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
horiz-margin : (integer-in 0 1000) = 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
min-width : (integer-in 0 10000) = graphical-minimum-width | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
min-height : (integer-in 0 10000) = graphical-minimum-height | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stretchable-width : any/c = #t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stretchable-height : any/c = #t |
If & occurs in label, it is specially parsed as for button%.
The choices list specifies the initial list of items to appear in the list box.
The callback procedure is called when the user changes the list box selection, by either selecting, re-selecting, deselecting, or double-clicking an item. The type of the event provided to the callback is 'list-box-dclick when the user double-clicks on an item, or 'list-box otherwise.
'single – Creates a single-selection list.
'multiple – Creates a multiple-selection list where a single click deselects other items and selects a new item. Use this style for a list when single-selection is common, but multiple selections are allowed.
'extended – Creates a multiple-selection list where a single click extends or contracts the selection by toggling the clicked item. Use this style for a list when multiple selections are the rule rather than the exception.
If style includes 'vertical-label, then the list box is created with a label above the control; if style does not include 'vertical-label (and optionally includes 'horizontal-label), then the label is created to the left of the list box. If style includes 'deleted, then the list box is created as hidden, and it does not affect its parent’s geometry; the list box can be made active later by calling parent’s add-child method.
If selection is an integer, it is passed to set-selection to set the initial selection. The selection must be less than the length of choices.
The font argument determines the font for the control content, and label-font determines the font for the control label. For information about the enabled argument, see window<%>. For information about the horiz-margin and vert-margin arguments, see subarea<%>. For information about the min-width, min-height, stretchable-width, and stretchable-height arguments, see area<%>.
See also append in list-control<%>.
(send a-list-box delete n) → void? |
n : exact-nonnegative-integer? |
Selected items that are not deleted remain selected, and no other items are selected.
(send a-list-box get-data n) → any/c |
n : exact-nonnegative-integer? |
(send a-list-box get-first-visible-item) |
→ exact-nonnegative-integer? |
(send a-list-box get-label-font) → (is-a?/c font%) |
(send a-list-box get-selections) |
→ (listof exact-nonnegative-integer?) |
For single-selection lists, the result is always either null or a list containing one number.
(send a-list-box is-selected? n) → boolean? |
n : exact-nonnegative-integer? |
A list box’s selection can be changed by the user clicking the control, and such changes do not go through this method; use the control callback procedure (provided as an initialization argument) to monitor selection changes.
(send a-list-box number-of-visible-items) |
→ exact-positive-integer? |
(send a-list-box select n [select?]) → void? |
n : exact-nonnegative-integer? |
select? : any/c = #t |
If select? is #f, the item indexed by n is deselected; otherwise it is selected. List box items are indexed from 0. If n is equal to or larger than the number of choices, an exn:fail:contract exception is raised.
A list box’s selection can be changed by the user clicking the control, and such changes do not go through this method; use the control callback procedure (provided as an initialization argument) to monitor selection changes.
The control’s callback procedure is not invoked.
(send a-list-box set choices) → void? |
choices : (listof label-string?) |
(send a-list-box set-data n data) → void? |
n : exact-nonnegative-integer? |
data : any/c |
See also append.
(send a-list-box set-first-visible-item n) → void? |
n : exact-nonnegative-integer? |
A list box’s scroll position can be changed by the user clicking the control, and such changes do not go through this method. A program cannot detect when the scroll position changes except by polling get-first-visible-item.
(send a-list-box set-string n label) → void? |
n : exact-nonnegative-integer? |
label : label-string? |