OnDgsComboBoxSelect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} __NOTOC__ This event is fired when the item of a DGS combo box is selected. ==Parameters== <syntaxhighlight lang="lua"> integer previous, integer current <...")
 
Line 16: Line 16:
This example outputs a message with the selected item when an item is selected.
This example outputs a message with the selected item when an item is selected.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DGS = exports.dgs
comboBox = DGS:dgsDxCreateComboBox(500,400,200,30,false)
for i=1,20 do
DGS:dgsDxComboBoxAddItem(comboBox ,i)
end
function onSelected(previous,current)
function onSelected(previous,current)
outputChatBox("Last Selection:"..(previous or "None").." ;"Current Selection:"..(current or "None"))
outputChatBox("Last Selection:"..(previous or "None").." ;"Current Selection:"..(current or "None"))

Revision as of 14:01, 25 August 2017

This event is fired when the item of a DGS combo box is selected.

Parameters

integer previous, integer current
  • previous: The item id that last selected.
  • current: The item id that got selected.

Source

The source of this event is the combo box element that got its item selected.

Example

This example outputs a message with the selected item when an item is selected.

DGS = exports.dgs

comboBox = DGS:dgsDxCreateComboBox(500,400,200,30,false)
for i=1,20 do
	DGS:dgsDxComboBoxAddItem(comboBox ,i)
end

function onSelected(previous,current)
	outputChatBox("Last Selection:"..(previous or "None").." ;"Current Selection:"..(current or "None"))
end
addEventHandler("onClientDgsDxComboBoxSelect",getRootElement(),onSelected)

See Also

GUI events

Input

GUI


Client event functions