OnClientGUIComboBoxAccepted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element comboBox
element theElement
</syntaxhighlight>
</syntaxhighlight>
*'''comboBox:''' the [[Element/GUI/Combobox|combobox]] that got accepted.
*'''theElement:''' the [[Element/GUI/Combobox|combobox]] that got accepted.


==Example==
==Example==
Line 28: Line 28:


==See Also==
==See Also==
===GUI events===
{{GUI_events}}
{{GUI_events}}
===Client event functions===
===Client event functions===
{{Client_event_functions}}
{{Client_event_functions}}

Latest revision as of 14:30, 20 May 2018

This event is called when a combobox gets accepted.

Parameters

element theElement
  • theElement: the combobox that got 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


Client event functions