2.1.27 list-control<%>

► |  | GUI: Racket Graphics Toolkit

1 | Overview
2 | Reference
3 | Configuration
4 | Dynamic Loading
| Bibliography
| Index

► | 2 | Reference

2.1 | Windowing Classes
2.2 | Windowing Functions
2.3 | Drawing Classes
2.4 | Drawing Functions
2.5 | Editor Classes
2.6 | Editor Functions
2.7 | WXME Decoding

▼ | 2.1 | Windowing Classes

2.1.1 | area<%>
2.1.2 | area-container<%>
2.1.3 | area-container-window<%>
2.1.4 | button%
2.1.5 | canvas<%>
2.1.6 | canvas%
2.1.7 | check-box%
2.1.8 | checkable-menu-item%
2.1.9 | choice%
2.1.10 | clipboard-client%
2.1.11 | clipboard<%>
2.1.12 | combo-field%
2.1.13 | control<%>
2.1.14 | control-event%
2.1.15 | cursor%
2.1.16 | dialog%
2.1.17 | event%
2.1.18 | frame%
2.1.19 | gauge%
2.1.20 | group-box-panel%
2.1.21 | grow-box-spacer-pane%
2.1.22 | horizontal-pane%
2.1.23 | horizontal-panel%
2.1.24 | key-event%
2.1.25 | labelled-menu-item<%>
2.1.26 | list-box%
2.1.27 | list-control<%>
2.1.28 | menu%
2.1.29 | menu-bar%
2.1.30 | menu-item<%>
2.1.31 | menu-item%
2.1.32 | menu-item-container<%>
2.1.33 | message%
2.1.34 | mouse-event%
2.1.35 | pane%
2.1.36 | panel%
2.1.37 | popup-menu%
2.1.38 | radio-box%
2.1.39 | selectable-menu-item<%>
2.1.40 | separator-menu-item%
2.1.41 | scroll-event%
2.1.42 | slider%
2.1.43 | subarea<%>
2.1.44 | subwindow<%>
2.1.45 | tab-panel%
2.1.46 | text-field%
2.1.47 | timer%
2.1.48 | top-level-window<%>
2.1.49 | vertical-pane%
2.1.50 | vertical-panel%
2.1.51 | window<%>

On this page:

append
clear
find-string
get-number
get-selection
get-string
get-string-selection
set-selection
set-string-selection

Inherited methods:
from control<%>
command
get-font
from window<%>
accept-drop-files
client->screen
enable
focus
get-client-size
get-cursor
get-handle
get-height
get-label
get-plain-label
get-size
get-width
get-x
get-y
has-focus?
is-enabled?
is-shown?
on-drop-file
on-focus
on-move
on-size
on-subwindow-char
on-subwindow-event
on-superwindow-enable
on-superwindow-show
popup-menu
refresh
screen->client
set-cursor
set-label
show
from area<%>
get-graphical-min-size
get-parent
get-top-level-window
min-height
min-width
stretchable-height
stretchable-width
from subarea<%>
horiz-margin
vert-margin

top← prev up next →

list-control<%> : interface?

implements: | control<%>

A list control gives the user a list of string items to choose from. There are two built-in classes that implement list-control<%>:

- choice% – presents the list in a popup menu (so the user can choose only one item at a time)

- list-box% – presents the list in a scrolling box, allowing the use to choose one item (if the style includes 'single) or any number of items

In either case, the set of user-selectable items can be changed dynamically.

( send a-list-control append item) → void?
item : string

Adds a new item to the list of user-selectable items. The current selection is unchanged (unless the list control is an empty choice control, in which case the new item is selected).

( send a-list-control clear) → void?

Removes all user-selectable items from the control.

( send a-list-control find-string s)
→ ( or/c exact-nonnegative-integer? false/c)
s : string

Finds a user-selectable item matching the given string. If no matching choice is found, #f is returned, otherwise the index of the matching choice is returned (items are indexed from 0).

( send a-list-control get-number) → exact-nonnegative-integer?

Returns the number of user-selectable items in the control (which is also one more than the greatest index in the list control).

( send a-list-control get-selection)
→ ( or/c exact-nonnegative-integer? false/c)

Returns the index of the currently selected item (items are indexed from 0). If the choice item currently contains no choices or no selections, #f is returned. If multiple selections are allowed and multiple items are selected, the index of the first selection is returned.

( send a-list-control get-string n)
→ ( and/c immutable? label-string?)
n : exact-nonnegative-integer?

Returns the item for the given index (items are indexed from 0). If the provided index is larger than the greatest index in the list control, an exn:fail:contract exception is raised.

( send a-list-control get-string-selection)
→ ( or/c ( and/c immutable? label-string?) false/c)

Returns the currently selected item. If the control currently contains no choices, #f is returned. If multiple selections are allowed and multiple items are selected, the first selection is returned.

( send a-list-control set-selection n) → void?
n : exact-nonnegative-integer?

Selects the item specified by the given index (items are indexed from 0). If the given index larger than the greatest index in the list control, an exn:fail:contract exception is raised.

In a list box control, all other items are deselected, even if multiple selections are allowed in the control. See also select in list-box%.

The control’s callback procedure is not invoked when this method is called.

The list control’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-control set-string-selection s) → void?
s : string

Selects the item that matches the given string. If no match is found in the list control, an exn:fail:contract exception is raised.

In a list box control, all other items are deselected, even if multiple selections are allowed in the control. See also select in list-box%.

The control’s callback procedure is not invoked when this method is called.

The list control’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.

top← prev up next →