GuiComboBoxGetItemText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Syntax added. Example needed.)
 
(Added example)
Line 16: Line 16:


==Example==  
==Example==  
This outputs selected item's text to the chatbox.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--Todo..
local item = guiComboBoxGetSelected(comboBox)
local text = guiComboBoxGetItemText(comboBox, item)
 
outputChatBox("You have selected: " .. text)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 16:44, 26 February 2012

This function retrieves the text from a specific combobox item.

Syntax

string guiComboBoxGetItemText ( element comboBox, int itemId )

Required Arguments

  • comboBox: The combobox containing the item you're interested in
  • itemId: The index of the item

Returns

Returns the text of the item if the arguments are right, false otherwise.

Example

This outputs selected item's text to the chatbox.

local item = guiComboBoxGetSelected(comboBox)
local text = guiComboBoxGetItemText(comboBox, item)

outputChatBox("You have selected: " .. text)

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows