Back: BLOX.BDialog-widget protocol Up: BLOX package Forward: BLOX.BDropDown-accessing   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.12 BLOX.BDropDown

Defined in namespace BLOX
Superclass: BLOX.BExtended
Category: Graphics-Examples
This class is an abstract superclass for widgets offering the ability to pick items from a pre-built list. The list is usually hidden, but a button on the right of this widgets makes it pop up. This widget is thus composed of three parts: an unspecified text widget (shown on the left of the button and always visible), the button widget (shown on the right, it depicts a down arrow, and is always visible), and the pop-up list widget.

1.12.1 BLOX.BDropDown: accessing  (instance)
1.12.2 BLOX.BDropDown: callbacks  (instance)
1.12.3 BLOX.BDropDown: flexibility  (instance)
1.12.4 BLOX.BDropDown: list box accessing  (instance)
1.12.5 BLOX.BDropDown: widget protocol  (instance)


1.12.1 BLOX.BDropDown: accessing

backgroundColor
Answer the value of the backgroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well.

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

backgroundColor: aColor
Set the value of the backgroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well.

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

droppedRows
Answer the number of items that are visible at any time in the listbox.

droppedRows: anInteger
Set the number of items that are visible at any time in the listbox.

font
Answer the value of the font option for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well.

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, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well.

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 for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well.

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

foregroundColor: aColor
Set the value of the foregroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well.

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 list widget.

highlightBackground: aColor
Set the value of the highlightBackground option for the widget.

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

highlightForeground
Answer the value of the highlightForeground option for the widget.

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

highlightForeground: aColor
Set the value of the highlightForeground option for the widget.

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


1.12.2 BLOX.BDropDown: callbacks

callback
Answer a DirectedMessage that is sent when the receiver is clicked, or nil if none has been set up.

callback: aReceiver message: aSymbol
Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is clicked. If the method accepts an argument, the receiver is passed.

invokeCallback
Generate a synthetic callback


1.12.3 BLOX.BDropDown: flexibility

createList
Create the popup widget to be used for the `drop-down list'. It is a BList by default, but you can use any other widget, overriding the `list box accessing' methods if necessary.

createTextWidget
Create the widget that will hold the string chosen from the list box and answer it. The widget must be a child of `self primitive'.

itemHeight
Answer the height of an item in the drop-down list. The default implementation assumes that the receiver understands #font, but you can modify it if you want.

listCallback
Called when an item of the listbox is highlighted. Do nothing by default

listSelectAt: aPoint
Select the item lying at the given position in the list box. The default implementation assumes that list is a BList, but you can modify it if you want.

listText
Answer the text currently chosen in the list box. The default implementation assumes that list is a BList, but you can modify it if you want.

text
Answer the text that the user has picked from the widget and/or typed in the control (the exact way the text is entered will be established by subclasses, since this is an abstract method).

text: aString
Set the text widget to aString


1.12.4 BLOX.BDropDown: list box 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.

contents: stringCollection
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: elementList
Set the elements displayed in the listbox, and set the labels to be their displayStrings.

index: newIndex
Highlight the item at the given position in the listbox, and transfer the text in the list box to the text widget.

labelAt: anIndex
Answer the label displayed at the given position in the list box.

labelsDo: aBlock
Iterate over the labels in the list widget and pass each of them to aBlock.

numberOfStrings
Answer the number of items in the list box

would

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


1.12.5 BLOX.BDropDown: widget protocol

dropRectangle
Answer the rectangle in which the list widget will pop-up. If possible, this is situated below the drop-down widget's bottom side, but if the screen space there is not enough it could be above the drop-down widget's above side. If there is no screen space above as well, we pick the side where we can offer the greatest number of lines in the pop-up widget.

dropdown
Force the pop-up list widget to be visible.

isDropdownVisible
Answer whether the pop-up widget is visible

toggle
Toggle the visibility of the pop-up widget.

unmapList
Unmap the pop-up widget from the screen, transfer its selected item to the always visible text widget, and generate a callback.



Back: BLOX.BDropDown-list box accessing Up: BLOX.BDropDown Forward: BLOX.BDropDownEdit   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html