DgsSetVisible: Difference between revisions
Jump to navigation
Jump to search
m (In the example was dgsGetVisible used, but DGS wasn't indexed to get access to that export function.) |
(DGS (OOP Syntax)/(Template Organization) Mission) |
||
Line 6: | Line 6: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool dgsSetVisible ( element dgsElement, bool state ) | bool dgsSetVisible ( element dgsElement, bool state ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{DGS/OOP||DGSElement:setVisible||visible|dgsGetVisible}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 52: | Line 53: | ||
</syntaxhighlight></section> | </syntaxhighlight></section> | ||
=See Also= | |||
{{ | |||
==<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:07, 19 April 2021
This function changes the visibility state of a DGS element.
Syntax
bool dgsSetVisible ( element dgsElement, bool state )
DGS OOP Syntax Help! I don't understand this!
Required Arguments
- dgsElement: the DGS 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 creates a dgs window and changes its visibility every 2 seconds, infinite times.
DGS = exports.dgs function changeVisibility ( ) -- we check if the dgs element is visible DGS:dgsSetVisible (myWindow, not DGS:dgsGetVisible ( myWindow ) ) end --Create a dgs window called 'myWindow' myWindow = DGS:dgsCreateWindow ( 0.3, 0.3, 0.5, 0.60, "DGS window title", true ) --Set a timer to change the window's visibility every 2 seconds, infinite times setTimer ( changeVisibility, 2000, 0 )
This example creates a dgs window with yes and no buttons and make it visible/invisible with the bindkey 'x'.
Click to collapse [-]
ClientDGS = exports.dgs newdgs = { button = {}, wind= {} } addEventHandler("onClientResourceStart", resourceRoot,function() newdgs.wind[1] = DGS:dgsDxCreateWindow(434, 304, 280, 123, "New Window", false) DGS:dgsDxWindowSetSizable(newdgs.wind[1], false) newdgs.button[1] = DGS:dgsDxCreateButton(35, 46, 87, 40, "yes", false, newdgs.wind[1]) newdgs.button[2] = DGS:dgsDxCreateButton(166, 49, 92, 37, "no", false, newdgs.wind[1]) end) bindKey ( "x", "down", function ( ) local state = ( not DGS:dgsGetVisible( newdgs.wind[1] ) ) DGS:dgsSetVisible( newdgs.wind[1], state ) showCursor ( state ) end)
See Also
General Functions
- dgsGetPosition
- dgsSetPosition
- dgsSetParent
- dgsGetParent
- dgsGetChild
- dgsGetChildren
- dgsGetSize
- dgsSetSize
- dgsGetType
- dgsSetLayer
- dgsGetLayer
- dgsSetCurrentLayerIndex
- dgsGetCurrentLayerIndex
- dgsGetLayerElements
- dgsGetProperty
- dgsSetProperty
- dgsSetPropertyInherit
- dgsGetProperties
- dgsSetProperties
- dgsGetVisible
- dgsSetVisible
- dgsGetEnabled
- dgsSetEnabled
- dgsGetPositionAlignment
- dgsSetPositionAlignment
- dgsGetAlpha
- dgsSetAlpha
- dgsGetFont
- dgsSetFont
- dgsGetText
- dgsSetText
- dgsGetPostGUI
- dgsSetPostGUI
- dgsGetInputEnabled
- dgsSetInputEnabled
- dgsGetInputMode
- dgsSetInputMode
- dgsAttachToAutoDestroy
- dgsDetachFromAutoDestroy
- dgsFocus
- dgsBlur
- dgsCreateFont
- dgsBringToFront
- dgsMoveToBack
- dgsGetScreenSize
- dgsGetCursorPosition
- dgsGetMouseEnterGUI
- dgsGetMouseLeaveGUI
- dgsIsMouseWithinGUI
- dgsSetSystemFont
- dgsGetSystemFont
- dgsGetElementsInLayer
- dgsGetElementsFromResource
- dgsGetFocusedGUI
- dgsImportFunction
- dgsImportOOPClass
- dgsG2DLoadHooker
- dgsSetRenderSetting
- dgsGetRenderSetting
- dgsSimulateClick
- dgsGetRootElement
- dgsAddMoveHandler
- dgsRemoveMoveHandler
- dgsIsMoveHandled
- dgsAddSizeHandler
- dgsRemoveSizeHandler
- dgsIsSizeHandled
- dgsAttachElements
- dgsDetachElements
- dgsElementIsAttached
- dgsAddPropertyListener
- dgsRemovePropertyListener
- dgsGetListenedProperties
- dgsSetMultiClickInterval
- dgsGetMultiClickInterval
- dgsSetMouseStayDelay
- dgsGetMouseStayDelay
- dgsCenterElement
- dgsSetElementKeeperEnabled
- dgsGetElementKeeperEnabled
- dgsSetClickingSound
- dgsGetClickingSound
- dgsSetClickingSoundVolume
- dgsGetClickingSoundVolume
General Events
- onDgsBlur
- onDgsCreate
- onDgsCursorTypeChange
- onDgsCursorStateChange
- onDgsDestroy
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsElementEnter
- onDgsElementLeave
- onDgsFocus
- onDgsKey
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTextChange
- onDgsWindowClose
- onDgsPropertyChange