OnClientGUIComboBoxAccepted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created .)
 
mNo edit summary
Line 18: Line 18:
         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 ( tostring ( text ) and tostring ( text ) ~= "" ) then
             if ( text ~= "" ) then
                 guiSetText ( Combo , text )
                 guiSetText ( Combo , text )
             end
             end

Revision as of 18:28, 28 August 2012

This event is called when a ComboBox get accepted

Parameters

element ComboBox
  • ComboBox: the ComboBox that got accepted.

Example

This example will set the memo text to the selected combo box 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 ( Combo , text )
            end
        end
    end
)

See Also

GUI events

Input

GUI


Client event functions