GuiCheckBoxGetSelected: Difference between revisions
Jump to navigation
Jump to search
(Undo revision 27628 by Alsa7er2011 (talk) Your example makes absolutely no sense, please learn to script before submitting an example) |
No edit summary |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This | This example makes a different beep based on the state when any checkbox has been clicked. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function checkboxBleepWhenClicked() | ||
if ( getElementType(source) == "gui-checkbox" ) then -- Is the element clicked a checkbox? | |||
if ( guiCheckBoxGetSelected(source) ) then | |||
playSoundFrontEnd(1) -- If the checkbox is selected play sound 1. | |||
else | |||
playSoundFrontEnd(2) -- If the checkbox isn't selected play sound 2. | |||
end | |||
end | |||
end | |||
addEventHandler("onClientGUIClick", root, checkboxBleepWhenClicked, false) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 16:39, 10 November 2011
This function gets a checkbox's selection state.
Syntax
bool guiCheckBoxGetSelected ( element theCheckbox )
Required Arguments
- theCheckbox : The checkbox you wish to retrieve the selection state of.
Returns
Returns true if the checkbox is selected, false if it is not.
Example
This example makes a different beep based on the state when any checkbox has been clicked.
function checkboxBleepWhenClicked() if ( getElementType(source) == "gui-checkbox" ) then -- Is the element clicked a checkbox? if ( guiCheckBoxGetSelected(source) ) then playSoundFrontEnd(1) -- If the checkbox is selected play sound 1. else playSoundFrontEnd(2) -- If the checkbox isn't selected play sound 2. end end end addEventHandler("onClientGUIClick", root, checkboxBleepWhenClicked, false)
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