- Lennon and McCartney
ComboBox
IComboBox
ComboBox Methods
ComboBox() | Constructor for the ComboBox class |
AddListItem() | Adds a text item to the end of the selection list (unless auto sort is on) |
SelectItem() | Manually selects the one based item from the selection list (zero clears the entry) |
GetSelectedItem() | Retrieves the one based index of the currently selected item (zero if empty or no match) |
SearchList() | Searches the ComboBox selection list for a matching string |
AddTextChangedHandler() | Registers an event handler for a text changed event using a method reference |
AddTextChangedHandler() | Registers an event handler for a text changed event using an IComboBox reference |
AddEnterKeyHandler() | Registers an event handler for an enter key event using a method reference |
AddEnterKeyHandler() | Registers an event handler for an enter key event using an IComboBox reference |
OnTextChanged() | Virtual method to handle TextChanged events - can be overridden |
OnEnterKey() | Virtual method to handle EnterKey events - can be overridden |
IComboBox Methods
OnTextChanged() | Virtual method to handle TextChanged events |
OnEnterKey() | Virtual method to handle EnterKey events |
Derived Classes
None
See Also
Class Hierarchy, Frame, ChildFrame, Dialog, Edit, TextChangedEvent, EnterKeyEvent
public method ComboBox(Window Parent, int XPos, int YPos, int Width, int Height, string TextString, bool AllowEdit = true, bool AutoSort = false, bool UseDropDown = true)
Parameters
Parent
Parent window for the combo box control
XPos
One based X position of control relative to parent
YPos
One based Y position of control relative to parent
Width
Initial width of the control in pixels
Height
Initial height of the control in pixels
TextString
Initial string to be used in the edit box
AllowEdit
Allow editing in the control if true, only from list if false
AutoSort
Sort the list alphabetically if true
UseDropDown
Use drop down list with arrow icon if true, list always visible if false
Return Value
None
Description
Constructor for the ComboBox class.
ComboBox Class
public method<bool> AddListItem(string SelectionString, bool AllowDuplicates = false, bool CaseSensitiveCompare = true)
Parameters
SelectionString
String to append at end of list for combo box selection list
AllowDuplicates
Allow duplicates in the selection list if true (false by default)
CaseSensitiveCompare
Use case sensitive compare if true (true by default)
Return Value
Returns true if successful and false if the item wasn't added
Description
This method adds an item to the end of the combo box selection list, by default. If the auto sort flag is set in the constructor, the item will be added into the appropriate location in the list based on the alphabetic sort. Several flags are also available to control the insertion of the item, including the option to allow duplicates in the list (false by default) and when comparing the item to be inserted to the items in the list, the CaseSensitiveCompare flag controls that comparison. If the item could not be added (caused by a duplicate in the list and AllowDuplicates is false), the method will return false. It will return true if the item is added successfully.
ComboBox Class
public method SelectItem(int ItemIndex)
Parameters
ItemIndex
One based index of the list item to be selected for the combo box
Return Value
NONE
Description
This method selects the specified item, resulting in the item being written into the edit control part of the combo box. The item is specified as a one based index into the current selection list. A value of zero is used to clear out the edit control.
ComboBox Class
public method<int> GetSelectedItem()
Parameters
None
Return Value
One based index from the selection list corresponding to the current combo box item
Description
This method returns a one based index for the currently selected item. If the current combo box value doesn't match an item in the selection list (applicable to "AllowEdit" == true), or if the combo box is currently empty, a value of zero is returned.
ComboBox Class
public method<int> SearchList(string SearchString, bool CaseSensitiveCompare = true)
Parameters
SearchString
String used to search through the selection list
CaseSensitiveCompare
Use case sensitive compare if true (true by default)
Return Value
Returns the one based index if a match was found and zero if no match found
Description
This method searches the combo box selection list looking for a match with the SearchString. The CaseSensitiveCompare flag controls the comparison. The method returns the one based position in the selection list if a match is found, and returns zero if no match is found.
ComboBox Class
public method AddTextChangedHandler(TextChangedHandler Handler, Base ExtraObject = null)
Parameters
Handler
Method reference to be executed when the event occurs
ExtraObject
Optional object which will be sent along to each event handler when it is executed
Return Value
NONE
Description
This method registers a method reference to be executed when a "text changed" event occurs within the ComboBox object (either from typing or selection from the list). The event provides a copy of the "old string" and the "new string". This event occurs "after the fact", the text has already been modified, but it allows the script to perform validation on the new data. The text can also be restored to "old string" if preferred.
As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.
The TextChangedHandler data type represents a method reference specific to a handler for TextChangedEvent. TextChangedHandler is defined as follows:
public type<method<TextChangedEvent,Base>> TextChangedHandler
Given this definition, the method handler must be defined with the following signature (name can be anything):
public method TextChangedMethod(TextChangedEvent event, Base Extra) { }.
ComboBox Class
public method AddTextChangedHandler(IComboBox Interface, Base ExtraObject = null)
Parameters
Interface
Reference to an IComboBox object
ExtraObject
Optional object which will be sent along to each event handler when it is executed
Return Value
NONE
Description
This method registers an IComboBox interface object to be executed when a "text changed" event occurs for this ComboBox control. An optional object can also be registered which will be sent to each event handler as it is executed.
As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.
When the text is modified in the ComboBox control, the OnTextChanged() method within the IComboBox object will be executed.
ComboBox Class
public method AddEnterKeyHandler(EnterKeyHandler Handler, Base ExtraObject = null)
Parameters
Handler
Method reference to be executed when the event occurs
ExtraObject
Optional object which will be sent along to each event handler when it is executed
Return Value
NONE
Description
This method registers a method reference to be executed when an "enter key" event occurs within the edit box within the ComboBox control (as opposed to using enter to select an item from the list).
As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.
The EnterKeyHandler data type represents a method reference specific to a handler for EnterKeyEvent. EnterKeyHandler is defined as follows:
public type<method<EnterKeyEvent,Base>> EnterKeyHandler
Given this definition, the method handler must be defined with the following signature (name can be anything):
public method EnterKeyMethod(EnterKeyEvent event, Base Extra) { }.
ComboBox Class
public method AddEnterKeyHandler(IComboBox Interface, Base ExtraObject = null)
Parameters
Interface
Reference to an IComboBox object
ExtraObject
Optional object which will be sent along to each event handler when it is executed
Return Value
NONE
Description
This method registers an IComboBox interface object to be executed when an "enter key" event occurs for the edit box within this ComboBox control. An optional object can also be registered which will be sent to each event handler as it is executed.
As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.
When the Enter key is pressed in the edit box, the OnEnterKey() method within the IComboBox object will be executed.
ComboBox Class
public method virtual OnTextChanged(TextChangedEvent TextEvent, Base ExtraObject)
Parameters
TextEvent
TextChangedEvent object associated with the event
ExtraObject
Optional object sent along from when it was registered
Return Value
NONE
Description
This method is the event handler for TextChangedEvent for the ComboBox control. It is invoked internally when the text is changed (character is typed into the edit box or selection from list). This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the ComboBox.AddTextChangedHandler() method register the event handlers which get invoked by this method.
If this method is overridden by a class derived from ComboBox, it must call this implementation of the method if it needs to execute handlers registered with the ComboBox.AddTextChangedHandler() methods.
ComboBox Class
public method virtual OnEnterKey(EnterKeyEvent KeyEvent, Base ExtraObject)
Parameters
KeyEvent
EnterKeyEvent object associated with the event
ExtraObject
Optional object sent along from when it was registered
Return Value
NONE
Description
This method is the event handler for EnterKeyEvent for the edit box within the ComboBox control. It is invoked internally when the text is changed (character is typed into the edit box or selection from list). This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the ComboBox.AddEnterKeyHandler() method register the event handlers which get invoked by this method.
If this method is overridden by a class derived from ComboBox, it must call this implementation of the method if it needs to execute handlers registered with the ComboBox.AddEnterKeyHandler() methods.
ComboBox Class
public method virtual OnTextChanged(TextChangedEvent TextEvent, Base ExtraObject)
Parameters
TextEvent
TextChangedEvent object associated with the event
ExtraObject
Optional object sent along from when it was registered
Return Value
NONE
Description
This virtual method is the event handler for TextChangedEvent within the IComboBox interface class. The method which overrides it is invoked for TextChangedEvent within a ComboBox object when the interface object is registered with the ComboBox.AddTextChangedHandler() method.
IComboBox Class
public method virtual OnEnterKey(EnterKeyEvent KeyEvent, Base ExtraObject)
Parameters
KeyEvent
EnterKeyEvent object associated with the event
ExtraObject
Optional object sent along from when it was registered
Return Value
NONE
Description
This virtual method is the event handler for EnterKeyEvent within the IComboBox interface class. The method which overrides it is invoked for EnterKeyEvent within a ComboBox object when the interface object is registered with the ComboBox.AddEnterKeyHandler() method.
IComboBox Class