GuiSetEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
This function enables/disables a GUI element. A disabled GUI element can't be used, gets a gray aspect and doesn't receive any events.
This function enables/disables a DGS element. A disabled DGS element can't be used, gets a gray aspect and doesn't receive any events.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool guiSetEnabled ( element guiElement, bool enabled )
bool dgsDxGUISetEnabled ( element dgsElement, bool enabled )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''guiElement:''' the GUI element you wish to enable or disable
*'''dgsElement:''' the DGS element you wish to enable or disable
*'''enabled:''' the new state
*'''enabled:''' the new state


Line 17: Line 17:
==Example==
==Example==
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">function ChangeMyButtonEnabled ( )         
<syntaxhighlight lang="lua">
         if ( guiGetEnabled ( MyButton ) == true ) then -- check if the element is enabled           
DGS = exports.dgs
                 guiSetEnabled ( MyButton, false ) -- if it is, we disable it
function ChangeMyButtonEnabled ( )         
         if ( DGS:dgsDxGUIGetEnabled ( MyButton ) == true ) then -- check if the element is enabled           
                 DGS:dgsDxGUISetEnabled ( MyButton, false ) -- if it is, we disable it
         else               
         else               
                 guiSetEnabled ( MyButton, true ) -- if not, we make it enabled
                 DGS:dgsDxGUISetEnabled ( MyButton, true ) -- if not, we make it enabled
         end
         end
end
end


MyGuiWindow = guiCreateWindow(254,206,478,306,"Awesome Gui Window",false) -- Your gui window
MyGuiWindow = DGS:dgsDxCreateWindow(254,206,478,306,"Awesome dgs Window",false) -- Your dgs window
MyButton = guiCreateButton(0.477,0.8268,0.1946,0.0784,"Hello World!",true,MyGuiWindow) -- Creates a button in your gui window</syntaxhighlight></section>
MyButton = DGS:dgsDxCreateButton(0.477,0.8268,0.1946,0.0784,"Hello World!",true,MyGuiWindow) -- Creates a button in your dgs window</syntaxhighlight></section>


==See Also==
==See Also==
{{GUI functions}}
{{DGSFUNCTIONS}}

Revision as of 03:12, 9 August 2017

This function enables/disables a DGS element. A disabled DGS element can't be used, gets a gray aspect and doesn't receive any events.

Syntax

bool dgsDxGUISetEnabled ( element dgsElement, bool enabled )

Required Arguments

  • dgsElement: the DGS element you wish to enable or disable
  • enabled: the new state

Returns

If the function succeeds it returns true, if it fails it returns false.

Example

Click to collapse [-]
Client
DGS = exports.dgs
function ChangeMyButtonEnabled ( )        
        if ( DGS:dgsDxGUIGetEnabled ( MyButton ) == true ) then -- check if the element is enabled           
                DGS:dgsDxGUISetEnabled ( MyButton, false ) -- if it is, we disable it
        else              
                DGS:dgsDxGUISetEnabled ( MyButton, true ) -- if not, we make it enabled
        end
end

MyGuiWindow = DGS:dgsDxCreateWindow(254,206,478,306,"Awesome dgs Window",false) -- Your dgs window
MyButton = DGS:dgsDxCreateButton(0.477,0.8268,0.1946,0.0784,"Hello World!",true,MyGuiWindow) -- Creates a button in your dgs window

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