Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

Now the doctor came in... stinking of gin...

And proceeded to lie on the table.

- Lennon and McCartney

 

aztec.ui.ComboBox

public class ComboBox from<Control>

Base

Window

Control

ComboBox

aztec.ui.IComboBox

public class abstract IComboBox from<Base>

Base

IComboBox

The ComboBox class provides a combination of a single line text edit control and a selection list which contains entries for the edit box. The arrow icon on the right side of the control pops up the selection list. A flag can be set to either allow editing in the control or only allow entries from the selection list.

 

The IComboBox class is an abstract interface class which contains a virtual event handler method for each of the events which the ComboBox class supports.

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

See Also

 


ComboBox()

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


AddListItem()

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


SelectItem()

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


GetSelectedItem()

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


SearchList()

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


AddTextChangedHandler()

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


AddTextChangedHandler()

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


AddEnterKeyHandler()

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


AddEnterKeyHandler()

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


OnTextChanged()

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


OnEnterKey()

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


OnTextChanged()

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


OnEnterKey()

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

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec