GuiCheckBoxGetSelected: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
This page lacks an example
This page lacks an example
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--add an example here
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
</syntaxhighlight>
</syntaxhighlight>



Revision as of 16:06, 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