OnDgsComboBoxSelect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 18: Line 18:
DGS = exports.dgs
DGS = exports.dgs


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


Line 26: Line 26:
outputChatBox("Last Selection:"..(previous or "None")..";Current Selection:"..(current or "None"))
outputChatBox("Last Selection:"..(previous or "None")..";Current Selection:"..(current or "None"))
end
end
addEventHandler("onClientDgsDxComboBoxSelect",getRootElement(),onSelected)
addEventHandler("onDgsComboBoxSelect",getRootElement(),onSelected)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 13:39, 20 January 2018

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

Parameters

integer current, integer previous
  • current: The item id that got selected.
  • previous: The item id that last 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:dgsCreateComboBox(500,400,200,30,false)
for i=1,20 do
	DGS:dgsComboBoxAddItem(comboBox ,i)
end

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

See Also

DGS events

General

Check Box

Combo Box

Drag'N Drop

Edit

Grid List

Menu

Selector

Mouse

Radio Button

Switch Button

Tab

Animation

Plugin

Media

Color Picker

QRCode

Remote Image

Client event functions