ComboBoxChangedEvent

Package: Libraries.Interface.Events · Inherits from: Libraries.Language.Object

The ComboBoxChangedEvent says the user chose a different choice in a ComboBox: by clicking it in the list, by pressing Enter on the highlighted choice, or by leaving the field with text that is a different choice's, or no choice's. It holds the combo box, the index of the old and new choices (-1 for none), and the chosen text.

Example Code

use Libraries.Interface.Events.ComboBoxChangedEvent
use Libraries.Interface.Events.ComboBoxListener

class SizeListener is ComboBoxListener
    text size = ""

    action ComboBoxChanged(ComboBoxChangedEvent event)
        size = event:GetText()
    end
end

Actions

GetComboBox()

This action returns the combo box whose choice changed.

Returns

Libraries.Interface.Controls.ComboBox: The combo box.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent
use Libraries.Interface.Controls.ComboBox

ComboBoxChangedEvent event
ComboBox box = event:GetComboBox()

GetNewIndex()

This action returns the index of the choice after the change, or -1 if the field's text is no choice's.

Returns

integer: The new index.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent

ComboBoxChangedEvent event
integer index = event:GetNewIndex()

GetOldIndex()

This action returns the index of the choice before the change, or -1 if nothing was chosen.

Returns

integer: The old index.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent

ComboBoxChangedEvent event
integer index = event:GetOldIndex()

GetText()

This action returns the chosen text: the new choice's text, or the field's text when no choice is chosen.

Returns

text: The chosen text.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent

ComboBoxChangedEvent event
text chosen = event:GetText()

SetComboBox(Libraries.Interface.Controls.ComboBox box)

This action sets the combo box whose choice changed.

Parameters

Example

use Libraries.Interface.Events.ComboBoxChangedEvent
use Libraries.Interface.Controls.ComboBox

ComboBox box
ComboBoxChangedEvent event
event:SetComboBox(box)

SetNewIndex(integer index)

This action sets the index of the choice after the change.

Parameters

  • index integer: The new index, or -1 for none.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent

ComboBoxChangedEvent event
event:SetNewIndex(1)

SetOldIndex(integer index)

This action sets the index of the choice before the change.

Parameters

  • index integer: The old index, or -1 for none.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent

ComboBoxChangedEvent event
event:SetOldIndex(0)

SetText(text value)

This action sets the chosen text.

Parameters

  • value text: The chosen text.

Example

use Libraries.Interface.Events.ComboBoxChangedEvent

ComboBoxChangedEvent event
event:SetText("Medium")

Inherited Actions

3 actions from Libraries.Language.Object