DgsGetVisible: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(DGS (OOP Syntax)/(Template Organization) Mission)
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dgsGetVisible ( element guiElement )
bool dgsGetVisible ( element guiElement )
</syntaxhighlight>  
</syntaxhighlight>
{{DGS/OOP||DGSElement:getVisible||visible|dgsSetVisible}}


===Required Arguments===  
===Required Arguments===  
Line 30: Line 31:
bindKey ( "space", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible</syntaxhighlight>
bindKey ( "space", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible</syntaxhighlight>


==See Also==
=See Also=
{{DGSFUNCTIONS}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>==
{{DGS General Functions}}
 
==<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Events</span>==
{{DGS Events/General}}

Revision as of 17:12, 19 April 2021

This function determines if a DGS element is visible.

Syntax

bool dgsGetVisible ( element guiElement )

DGS OOP Syntax Help! I don't understand this!

Required Arguments

  • guiElement: the DGS element to be checked

Returns

Returns true if the element is visible, false otherwise.

Example

This example toggles the visibility of myWindow.

DGS = exports.dgs

function guiToggleVisible ( )        
        if ( DGS:dgsGetVisible ( myWindow ) == true ) then -- check if the dgs element is visible               
                DGS:dgsSetVisible ( myWindow, false ) -- if it is, we hide it
        else              
                DGS:dgsSetVisible ( myWindow, true ) -- if not, we make it visible
        end
end

myWindow = DGS:dgsCreateWindow ( 0, 0, .5, .5, "my window", true ) -- Create the dgs window
bindKey ( "space", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible

See Also

General Functions

General Events