OnClientGUIComboBoxAccepted: Difference between revisions
Jump to navigation
Jump to search
(Created .) |
Fernando187 (talk | contribs) mNo edit summary |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Client event}} | {{Client event}} | ||
__NOTOC__ | __NOTOC__ | ||
This event is called when a | This event is called when a [[Element/GUI/Combobox|combobox]] gets accepted. | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element | element theElement | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*''' | *'''theElement:''' the [[Element/GUI/Combobox|combobox]] that got accepted. | ||
==Source== | |||
The source of this event is the GUI combo box that was accepted. | |||
==Example== | ==Example== | ||
This example will set the memo text to the selected | This example will set the memo text to the selected combobox item text. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Combo = guiCreateComboBox ( 0.20, 0.03, 0.25, 0.30, "Example", true ) | Combo = guiCreateComboBox ( 0.20, 0.03, 0.25, 0.30, "Example", true ) | ||
Line 18: | Line 21: | ||
if ( comboBox == Combo ) then | if ( comboBox == Combo ) then | ||
local item = guiComboBoxGetSelected ( Combo ) | local item = guiComboBoxGetSelected ( Combo ) | ||
local text = guiComboBoxGetItemText ( Combo , item ) | local text = tostring ( guiComboBoxGetItemText ( Combo , item ) ) | ||
if | if ( text ~= "" ) then | ||
guiSetText ( | guiSetText ( Memo , text ) | ||
end | end | ||
end | end | ||
Line 28: | Line 31: | ||
==See Also== | ==See Also== | ||
{{GUI_events}} | {{GUI_events}} | ||
===Client event functions=== | ===Client event functions=== | ||
{{Client_event_functions}} | {{Client_event_functions}} |
Latest revision as of 16:11, 29 May 2025
This event is called when a combobox gets accepted.
Parameters
element theElement
- theElement: the combobox that got accepted.
Source
The source of this event is the GUI combo box that was accepted.
Example
This example will set the memo text to the selected combobox item text.
Combo = guiCreateComboBox ( 0.20, 0.03, 0.25, 0.30, "Example", true ) Memo = guiCreateMemo( 10, 50, 500, 150, "", false) addEventHandler ( "onClientGUIComboBoxAccepted", guiRoot, function ( comboBox ) if ( comboBox == Combo ) then local item = guiComboBoxGetSelected ( Combo ) local text = tostring ( guiComboBoxGetItemText ( Combo , item ) ) if ( text ~= "" ) then guiSetText ( Memo , text ) end end end )
See Also
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled