GuiSetVisible: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 4: Line 4:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiSetVisible ( element gui, bool visible )
bool guiSetVisible ( element guiElement, bool state )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''gui:''' the GUI element whose visibility is to be changed
*'''guiElement:''' the GUI element whose visibility is to be changed
*'''visible:''' the new visibility state
*'''state:''' the new visibility state


===Returns===
===Returns===
Line 15: Line 15:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example toggles gui element visibility.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function guiToggleVisible ( guiElement )
blabhalbalhb --abababa
--we check if the gui element is visible
--This line does this...
if ( guiGetVisible ( guiElement ) == true ) then
mooo
--if it is we hide it
guiSetVisible ( guiElement, false )
else
--if not, we make it visible
guiSetVisible ( guiElement, true )
end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{GUI_functions}}
{{GUI_functions}}
[[Category:Incomplete]]

Revision as of 14:26, 30 July 2007

This function changes the visibility state of a GUI element.

Syntax

bool guiSetVisible ( element guiElement, bool state )

Required Arguments

  • guiElement: the GUI element whose visibility is to be changed
  • state: the new visibility state

Returns

Returns true if the element's visibility could be changed, false otherwise.

Example

This example toggles gui element visibility.

function guiToggleVisible ( guiElement )
	--we check if the gui element is visible
	if ( guiGetVisible ( guiElement ) == true ) then
		--if it is we hide it
		guiSetVisible ( guiElement, false )
	else
		--if not, we make it visible
		guiSetVisible ( guiElement, true )
	end
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