DgsSetVisible

From Multi Theft Auto: Wiki
Revision as of 03:08, 9 August 2017 by Thisdp (talk | contribs) (Created page with "{{Client function}} __NOTOC__ This function changes the visibility state of a DGS element. ==Syntax== <syntaxhighlight lang="lua"> bool dgsDxGUISetVisible ( element dgsEleme...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function changes the visibility state of a DGS element.

Syntax

bool dgsDxGUISetVisible ( element dgsElement, bool state )

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:dgsDxGUISetVisible (myWindow, not dgsGetVisible ( myWindow ) )
end

--Create a dgs window called 'myWindow'
myWindow = DGS:dgsDxCreateWindow ( 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 [-]
Client
DGS = 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:dgsDxGUIGetVisible ( newdgs.wind[1] ) )
		DGS:dgsDxGUISetVisible ( newdgs.wind[1], state )
		showCursor ( state )
	end)

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips