GuiRadioButtonGetSelected: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:


==Example==
==Example==
This page lacks an example
This example creates a radio button then checks if one is selected and if it is, then it's output the title and sets the next radio button selected. (TESTED!)
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">hi = guiCreateRadioButton(243,204,36,16,"Hi",false)
--add an example here
guiRadioButtonSetSelected(hi,true)
bye = guiCreateRadioButton(243,224,41,16,"Bye",false)
 
if(guiRadioButtonGetSelected(hi))then
outputChatBox("Hi "..getPlayerName(localPlayer))
guiRadioButtonSetSelected(bye,true)
else
outputChatBox("Bye "..getPlayerName(localPlayer))
guiRadioButtonSetSelected(hi,true)
end
</syntaxhighlight>
</syntaxhighlight>



Revision as of 23:48, 27 April 2012

This function gets a radio button's selection state.

Syntax

bool guiRadioButtonGetSelected( element guiRadioButton )

Required Arguments

  • guiRadioButton: The radio button you wish to retrieve the selection state of.

Returns

Returns true if the radio button is selected, false if it is not.

Example

This example creates a radio button then checks if one is selected and if it is, then it's output the title and sets the next radio button selected. (TESTED!)

hi = guiCreateRadioButton(243,204,36,16,"Hi",false)
guiRadioButtonSetSelected(hi,true)
bye = guiCreateRadioButton(243,224,41,16,"Bye",false)

if(guiRadioButtonGetSelected(hi))then
	outputChatBox("Hi "..getPlayerName(localPlayer))
	guiRadioButtonSetSelected(bye,true)
else
	outputChatBox("Bye "..getPlayerName(localPlayer))
	guiRadioButtonSetSelected(hi,true)
end

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