GuiComboBoxGetItemText: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 18: | Line 18: | ||
This outputs selected item's text to the chatbox. | This outputs selected item's text to the chatbox. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local x,y = guiGetScreenSize() | |||
local guiWindow = createWindow(x/2-500,y/2-500,500,500,"myWindow",false,nil) | |||
local comboBox = guiCreateComboBox(0.1,0,1,0.8,0.8,"Select a value please",true,guiWindow) | |||
guiComboBoxAddItem(comboBox,"value1") | |||
local item = guiComboBoxGetSelected(comboBox) | local item = guiComboBoxGetSelected(comboBox) | ||
local text = guiComboBoxGetItemText(comboBox, item) | local text = guiComboBoxGetItemText(comboBox, item) | ||
if text then | |||
outputChatBox("You have selected: " .. text) | outputChatBox("You have selected: " .. text) | ||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{GUI functions}} | {{GUI functions}} |
Revision as of 23:35, 11 July 2017
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 x,y = guiGetScreenSize() local guiWindow = createWindow(x/2-500,y/2-500,500,500,"myWindow",false,nil) local comboBox = guiCreateComboBox(0.1,0,1,0.8,0.8,"Select a value please",true,guiWindow) guiComboBoxAddItem(comboBox,"value1") local item = guiComboBoxGetSelected(comboBox) local text = guiComboBoxGetItemText(comboBox, item) if text then outputChatBox("You have selected: " .. text) end
See Also
General functions
- guiBringToFront
- getChatboxLayout
- getChatboxCharacterLimit
- guiCreateFont
- guiBlur
- guiFocus
- guiGetAlpha
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSize
- guiGetText
- guiGetVisible
- guiMoveToBack
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSize
- guiSetText
- guiSetVisible
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive
Browsers
Buttons
Checkboxes
Comboboxes
- guiCreateComboBox
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
Edit Boxes
- guiCreateEdit
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
Gridlists
- guiCreateGridList
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListIsSortingEnabled
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
Memos
- guiCreateMemo
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoSetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
Progressbars
Radio Buttons
Scrollbars
Scrollpanes
- guiCreateScrollPane
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
Static Images
Tab Panels
Tabs
Text Labels
- guiCreateLabel
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign