GuiCheckBoxGetSelected: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Undo revision 27629 by Alsa7er2011 (talk) Your example makes absolutely no sense, please learn to script before submitting an example)
Line 15: Line 15:


==Example==
==Example==
This page lacks an example
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onClick (button, state, absoluteX, absoluteY) -- on Gui Click Func.
function onClick (button, state, absoluteX, absoluteY) -- on Gui Click Func.

Revision as of 16:30, 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 page lacks an example

function onClick (button, state, absoluteX, absoluteY) -- on Gui Click Func.
if ( source == myButton) then

	isSelected = guiCheckBoxGetSelected(CheckBox) -- check if the check box is selected
	
	if isSelected == true then -- if selected then
	outputChatBox("The CheckBox  is Selected")
	else -- else if its not selected
	outputChatBox("The CheckBox  is not Selected")
	end

end
end
addEventHandler ("onClientGUIClick", getRootElement(), onClick)  -- adding event handler for on click

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