OnDgsComboBoxAccepted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} __NOTOC__ This event is called when a dgs combo box gets accepted. ==Parameters== <syntaxhighlight lang="lua"> element theElement </syntaxhighlight> *'''the...")
 
(Blanked the page)
 
Line 1: Line 1:
{{Client event}}
__NOTOC__
This event is called when a dgs combo box gets accepted.


==Parameters==
<syntaxhighlight lang="lua">
element theElement
</syntaxhighlight>
*'''theElement:''' the dgs combo box that got accepted.
==Example==
This example will set the memo text to the selected combobox item text.
<syntaxhighlight lang="lua">
DGS = exports.dgs
Combo = DGS:dgsCreateComboBox ( 50, 40, 200, 20, "Example", false )
Memo = DGS:dgsCreateMemo( 50, 60, 200, 50, "", false)
addEventHandler ( "onDgsComboBoxAccepted", root,
    function ( comboBox )
        if ( comboBox == Combo ) then
            local item = DGS:dgsComboBoxGetSelected ( Combo )
            local text = tostring ( DGS:dgsComboBoxGetItemText ( Combo , item ) )
            if ( text ~= "" ) then
                DGS:dgsSetText ( Memo , text )
            end
        end
    end
)
</syntaxhighlight>
==See Also==
{{DGSEVENTS}}
===Client event functions===
{{Client_event_functions}}

Latest revision as of 15:21, 15 August 2019