Next: , Up: BLOX.BList   [Index]


1.25.1 BLOX.BList: accessing

add: anObject afterIndex: index

Add an element with the given value after another element whose index is contained in the index parameter. The label displayed in the widget is anObject’s displayString. Answer anObject.

add: aString element: anObject afterIndex: index

Add an element with the aString label after another element whose index is contained in the index parameter. This method allows the client to decide autonomously the label that the widget will display.

If anObject is nil, then string is used as the element as well. If aString is nil, then the element’s displayString is used as the label.

Answer anObject or, if it is nil, aString.

addLast: anObject

Add an element with the given value at the end of the listbox. The label displayed in the widget is anObject’s displayString. Answer anObject.

addLast: aString element: anObject

Add an element with the given value at the end of the listbox. This method allows the client to decide autonomously the label that the widget will display.

If anObject is nil, then string is used as the element as well. If aString is nil, then the element’s displayString is used as the label.

Answer anObject or, if it is nil, aString.

associationAt: anIndex

Answer an association whose key is the item at the given position in the listbox and whose value is the label used to display that item.

at: anIndex

Answer the element displayed at the given position in the list box.

backgroundColor

Answer the value of the backgroundColor option for the widget.

Specifies the normal background color to use when displaying the widget.

backgroundColor: value

Set the value of the backgroundColor option for the widget.

Specifies the normal background color to use when displaying the widget.

contents: elementList

Set the elements displayed in the listbox, and set the labels to be their displayStrings.

contents: stringCollection elements: elementList

Set the elements displayed in the listbox to be those in elementList, and set the labels to be the corresponding elements in stringCollection. The two collections must have the same size.

do: aBlock

Iterate over each element of the listbox and pass it to aBlock.

elements

Answer the collection of objects that represent the elements displayed by the list box.

elements: elementList

Set the elements displayed in the listbox, and set the labels to be their displayStrings.

font

Answer the value of the font option for the widget.

Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string.

X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding.

Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are “Helvetica 10 Bold”, “Times -14”, “Futura Bold Underline”. You must enclose the font family in braces if it is made of two or more words.

font: value

Set the value of the font option for the widget.

Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string.

X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding.

Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are “Helvetica 10 Bold”, “Times -14”, “Futura Bold Underline”. You must enclose the font family in braces if it is made of two or more words.

foregroundColor

Answer the value of the foregroundColor option for the widget.

Specifies the normal foreground color to use when displaying the widget.

foregroundColor: value

Set the value of the foregroundColor option for the widget.

Specifies the normal foreground color to use when displaying the widget.

highlightBackground

Answer the value of the highlightBackground option for the widget.

Specifies the background color to use when displaying selected items in the widget.

highlightBackground: value

Set the value of the highlightBackground option for the widget.

Specifies the background color to use when displaying selected items in the widget.

highlightForeground

Answer the value of the highlightForeground option for the widget.

Specifies the foreground color to use when displaying selected items in the widget.

highlightForeground: value

Set the value of the highlightForeground option for the widget.

Specifies the foreground color to use when displaying selected items in the widget.

index

Answer the value of the index option for the widget.

Indicates the element that has the location cursor. This item will be displayed in the highlightForeground color, and with the corresponding background color.

indexAt: point

Answer the index of the element that covers the point in the listbox window specified by x and y (in pixel coordinates). If no element covers that point, then the closest element to that point is used.

isSelected: index

Answer whether the element indicated by index is currently selected.

label

Return nil, it is here for Gtk+ support

label: aString

Do nothing, it is here for Gtk+ support

labelAt: anIndex

Answer the label displayed at the given position in the list box.

labels

Answer the labels displayed by the list box.

labelsDo: aBlock

Iterate over each listbox element’s label and pass it to aBlock.

mode

Answer the value of the mode option for the widget.

Specifies one of several styles for manipulating the selection. The value of the option may be either single, browse, multiple, or extended.

If the selection mode is single or browse, at most one element can be selected in the listbox at once. Clicking button 1 on an unselected element selects it and deselects any other selected item, while clicking on a selected element has no effect. In browse mode it is also possible to drag the selection with button 1. That is, moving the mouse while button 1 is pressed keeps the item under the cursor selected.

If the selection mode is multiple or extended, any number of elements may be selected at once, including discontiguous ranges. In multiple mode, clicking button 1 on an element toggles its selection state without affecting any other elements. In extended mode, pressing button 1 on an element selects it, deselects everything else, and sets the anchor to the element under the mouse; dragging the mouse with button 1 down extends the selection to include all the elements between the anchor and the element under the mouse, inclusive.

In extended mode, the selected range can be adjusted by pressing button 1 with the Shift key down: this modifies the selection to consist of the elements between the anchor and the element under the mouse, inclusive. The un-anchored end of this new selection can also be dragged with the button down. Also in extended mode, pressing button 1 with the Control key down starts a toggle operation: the anchor is set to the element under the mouse, and its selection state is reversed. The selection state of other elements is not changed. If the mouse is dragged with button 1 down, then the selection state of all elements between the anchor and the element under the mouse is set to match that of the anchor element; the selection state of all other elements remains what it was before the toggle operation began.

Most people will probably want to use browse mode for single selections and extended mode for multiple selections; the other modes appear to be useful only in special situations.

mode: value

Set the value of the mode option for the widget.

Specifies one of several styles for manipulating the selection. The value of the option may be either single, browse, multiple, or extended.

If the selection mode is single or browse, at most one element can be selected in the listbox at once. Clicking button 1 on an unselected element selects it and deselects any other selected item, while clicking on a selected element has no effect. In browse mode it is also possible to drag the selection with button 1. That is, moving the mouse while button 1 is pressed keeps the item under the cursor selected.

If the selection mode is multiple or extended, any number of elements may be selected at once, including discontiguous ranges. In multiple mode, clicking button 1 on an element toggles its selection state without affecting any other elements. In extended mode, pressing button 1 on an element selects it, deselects everything else, and sets the anchor to the element under the mouse; dragging the mouse with button 1 down extends the selection to include all the elements between the anchor and the element under the mouse, inclusive.

In extended mode, the selected range can be adjusted by pressing button 1 with the Shift key down: this modifies the selection to consist of the elements between the anchor and the element under the mouse, inclusive. The un-anchored end of this new selection can also be dragged with the button down. Also in extended mode, pressing button 1 with the Control key down starts a toggle operation: the anchor is set to the element under the mouse, and its selection state is reversed. The selection state of other elements is not changed. If the mouse is dragged with button 1 down, then the selection state of all elements between the anchor and the element under the mouse is set to match that of the anchor element; the selection state of all other elements remains what it was before the toggle operation began.

Most people will probably want to use browse mode for single selections and extended mode for multiple selections; the other modes appear to be useful only in special situations.

numberOfStrings

Answer the number of items in the list box

removeAtIndex: index

Remove the item at the given index in the list box, answering the object associated to the element (i.e. the value that #at: would have returned for the given index)

size

Answer the number of items in the list box


Next: , Up: BLOX.BList   [Index]