The following tasks are associated with using an IListBox*
part in visual composition. Tasks that are common to many parts
are described in related topics.
-
- Setting initial contents
- To define initial selection choices for the list box, set
the initialContents property in the IListBox*
property sheet. Open the Array of strings prompter window
from the value column, then enter the choices.
- Defining selection
- To specify the selection mode for the list box, open the style
property in the IListBox* property sheet. Then, specify
one of the following selection modes:
-
- Single selection
- Allows the user to select only one choice. Ensure
that neither the extendedSelect style nor
the multipleSelect style is on.
- Multiple selection
- Allows the user to individually select multiple
choices. Set the multipleSelect style to on.
- Extended selection
- Allows the user to select multiple choices by
dragging the mouse over them or by pressing
either the Shift key or the Ctrl key during
selection. Set the extendedSelect style to
on.
The class default style is shipped with single
selection as the default mode. Neither of the other
selection styles is set onin the default style, so
the <default> choice for these styles has
the same effect as selecting off.
- Getting the selected choice
- To copy the text of the selected item to an entry field
when a push button is selected, do the following:
- Connect the IPushButton* buttonClickEvent
feature to the IEntryField* text
attribute.
- Connect the IListBox* selectionText
attribute to the buttonClickEvent-to-text
connection. This provides the text of the
selected choice for the IEntryField* text
attribute.
- Adding a choice
- To add a new choice from an entry field to the end of the
list when a push button is pressed, do the following:
- Connect the IPushButton* buttonClickEvent
feature to the addAsLast action of the
IListBox* part.
- Connect the IEntryField* text attribute to
the text parameter of the buttonClickEvent-to-addAsLast
connection. This provides the entry field text as
the parameter for the addAsLast action.
- Removing a choice
- To remove the selected choice from the list box when a
push button is pressed, do the following:
- Connect the IPushButton* buttonClickEvent
feature to the remove action of the
IListBox* part.
- Connect the IListBox* selection attribute
to the index parameter of the buttonClickEvent-to-remove
connection. This provides the selection index as
the parameter for the remove action.
Common Tasks for Control Parts
Setting Part Style Properties
Setting Part Color Properties
Setting Part Font Properties
Setting Part Handlers
Properties
Setting Part Framing Properties
Working with VisualAge User
Interface Parts
IListBox
Property Settings --
IListBox
Portability -- IListBox