DGS General Basic Properties: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(20 intermediate revisions by 4 users not shown)
Line 12: Line 12:
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"alpha",alpha = 1)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"alpha",alpha = 1)</syntaxhighlight>
*'''alpha:''' The visibility/transparency of the DGS element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 0.80.
*'''alpha:''' The visibility/transparency of the DGS element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 0.80.
===clickCoolDown===
This property is used to limit the click frequency to a specific dgs element.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"clickCoolDown",clickCoolDown = false)</syntaxhighlight>
*'''clickCoolDown:''' A number indicates how long you want to limit the click (ms). Set to ''false'' to disable this.


===changeOrder===
===changeOrder===
Line 17: Line 22:
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"changeOrder",changeOrder = true)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"changeOrder",changeOrder = true)</syntaxhighlight>
*'''changeOrder:''' A bool indicates whether the layer will be changed when being brought to front ( or clicked ).
*'''changeOrder:''' A bool indicates whether the layer will be changed when being brought to front ( or clicked ).
===debugTrace===
This property stores the "debug tracing data" includes in which lua '''file''' and '''line''' the specific dgs element created (Only available using '''loadstring(exports.dgs:dgsImportFunction())()'''.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"debugTrace",debugTrace)</syntaxhighlight>
*'''debugTrace:''' A table stores creation data. Structure is as follows:
<syntaxhighlight lang="lua">
{
file=filePath,
line=lineNum,
fncName=functionName,
}
</syntaxhighlight>


===enabled===
===enabled===
Requires a bool value. This is equivalent to [[dgsSetEnabled]]/[[dgsGetEnabled]].
Requires a bool value. This is equivalent to [[dgsSetEnabled]]/[[dgsGetEnabled]].
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"enabled",alpha = true)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"enabled",enabled)</syntaxhighlight>
*'''enabled:''' The state.
*'''enabled:''' The state.
===enableFullEnterLeaveCheck===
Requires a bool value. This determines if target dgs element will have full check of mouse enter/leave. And you should use [[onDgsElementEnter]]/[[onDgsElementLeave]] instead of [[onDgsMouseEnter]]/[[onDgsMouseLeave]].
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"enableFullEnterLeaveCheck",enableFullEnterLeaveCheck)</syntaxhighlight>
*'''enableFullEnterLeaveCheck:''' The state.


===functionRunBefore===
===functionRunBefore===
Requires a bool value. Set whether the function runs before rendering or after rendering (see property '''functions''').
Requires a bool value. Set whether the function runs before rendering or after rendering (see property '''functions''').
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"functionRunBefore",functionRunBefore = true)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"functionRunBefore",functionRunBefore)</syntaxhighlight>
*'''functionRunBefore:''' Set to true, and the function will run before rendering. Set to false, and the function will run after rendering.
*'''functionRunBefore:''' Set to true, and the function will run before rendering. Set to false, and the function will run after rendering.


Line 34: Line 56:
*'''self:''' The DGS Element itself.
*'''self:''' The DGS Element itself.


See example on [[dgsSetProperty]]
See example in [[dgsSetProperty]]
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"functions",fncString,arg1,arg2,...)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"functions",fncString,arg1,arg2,...)</syntaxhighlight>
*'''fncString:''' The string of function to be loaded.
*'''fncString:''' The string of function to be loaded.
Line 41: Line 63:
*'''...:''' other arguments
*'''...:''' other arguments


===hitoutofparent===
===childOutsideHit===
Requires a bool value. Set whether children elements are clickable when they are outside of their parent element.
Requires a bool value. Set whether children elements are clickable when they are outside of their parent element.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"hitoutofparent",hitoutofparent = false)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"childOutsideHit",childOutsideHit = false)</syntaxhighlight>
*'''hitoutofparent:''' If set to true, the dgsElement's child elements are clickable even though they are not inside the bounding box of dgsElement.
*'''childOutsideHit:''' If set to true, the dgsElement's child elements are clickable even though they are not inside the bounding box of dgsElement.
 
===renderEventCall===
Requires a bool value. Set whether [[onDgsElementRender]] is triggered when rendering. (Don't always enable this, or it will cause severely performance decrease)
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"renderEventCall",renderEventCall = false)</syntaxhighlight>
*'''PixelInt:''' Set to true to enable, and false to disable.


===ignoreParentTitle===
===ignoreParentTitle===
Requires a bool value. Set whether to ignore the title of dgs-dxwindow.
Requires a bool value. Set whether to ignore the title of dgs-dxwindow.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"ignoreParentTitle",ignoreParentTitle = false)</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"ignoreParentTitle",ignoreParentTitle = false)</syntaxhighlight>
*'''PixelInt:''' Set to true to ignore the title of dgs-dxwindow if its parent is a dgs-dxwindow . Set to false to disable it, which means the y position of dgsElement in dgs-dxwindow will start to be calculated under the title.
*'''ignoreParentTitle:''' Set to true to ignore the title of dgs-dxwindow if its parent is a dgs-dxwindow . Set to false to disable it, which means the y position of dgsElement in dgs-dxwindow will start to be calculated under the title.


===PixelInt===
===mouseButtons===
Requires a bool value. Set whether the position/size of a dgs element is converted to integer while rendering, which deals with '''blur''' problem.
This property defines the specific mouse buttons that can be used to click on the element.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"PixelInt",PixelInt = true)</syntaxhighlight>
Syntax:
*'''PixelInt:''' Set to true to enable, and false to disable.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement, "mouseButtons", {bool left, bool right, bool middle})</syntaxhighlight>
 
*'''left''': Set this true to enable clicking with the left mouse button. Set it to false to disable clicking with the left mouse button.
===postGUI===
*'''right''': Set this to true to enable clicking with the right mouse button. Set it to false to disable clicking with the right mouse button.
Requires a bool value. Set whether the dgs element is post gui when render settings "postGUI" is ''nil''(automatic).
*'''middle''': Set this value to true to enable clicking with the middle mouse button. Set it to false to disable clicking with the middle mouse button.
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"postGUI",postGUI)</syntaxhighlight>
*'''postGUI:''' Set to true to enable post gui, or it wil under gui.


===outline===
===outline===
The border line of the bounding box of dgs element.
The border line of the bounding box of dgs element.
<syntaxhighlight lang="lua">dgsSetProperty(image,"outline",{side,width,color})</syntaxhighlight>
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"outline",{side,width,color,left,right,top,bottom})</syntaxhighlight>
*'''side''' : A string indicates which side the outline will attach to. The available values are as follows:
*'''side''' : A string indicates which side the outline will attach to. The available values are as follows:
**'''in'''
**'''in'''
Line 75: Line 90:
*'''width''': The width of the outline.
*'''width''': The width of the outline.
*'''color''': The color of the outline, which can be transformed by [[tocolor]].
*'''color''': The color of the outline, which can be transformed by [[tocolor]].
*'''left''': Set '''true''' to show outline in the left, and '''false''' to hide it. (Default is '''true''' if not set)
*'''right''': Set '''true''' to show the outline in the right, and '''false''' to hide it. (Default is '''true''' if not set)
*'''top''': Set '''true''' to show the outline at the top, and '''false''' to hide it. (Default is '''true''' if not set)
*'''bottom''': Set '''true''' to show the outline at the bottom, and '''false''' to hide it. (Default is '''true''' if not set)
===renderEventCall===
Requires a bool value. Set whether [[onDgsElementRender]] is triggered when rendering. (Don't always enable this, or it will cause severely performance decrease)
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"renderEventCall",renderEventCall = false)</syntaxhighlight>
*'''renderEventCall:''' Set to true to enable, and false to disable.
===postGUI===
Requires a bool value. Set whether the dgs element is post gui when render settings "postGUI" is ''nil''(automatic).
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"postGUI",postGUI)</syntaxhighlight>
*'''postGUI:''' Set to true to enable post gui, or it wil under gui.
===visible===
This property change the visibility of a dgs element. This is equivalent to [[dgsSetVisible]]/[[dgsGetVisible]].
<syntaxhighlight lang="lua">dgsSetProperty(dgsElement,"visible",visible)</syntaxhighlight>
*'''visible:''' A bool indicates whether the dgs element is visible or not.


==See Also==
==See Also==
{{DGSPROPERTIES}}
{{DGSPROPERTIES}}

Latest revision as of 05:19, 2 June 2024

DGS Properties is always used to change the gui style and make it more fantastic.

This page shows the general properties of all dgs elements that you could use.

Main Functions

Properties

alpha

Require a number ranges from 0 to 1. This is equivalent to dgsSetAlpha/dgsGetAlpha.

dgsSetProperty(dgsElement,"alpha",alpha = 1)
  • alpha: The visibility/transparency of the DGS element. Ranges from 0 (fully transparent) to 1 (fully opaque). Default value is 0.80.

clickCoolDown

This property is used to limit the click frequency to a specific dgs element.

dgsSetProperty(dgsElement,"clickCoolDown",clickCoolDown = false)
  • clickCoolDown: A number indicates how long you want to limit the click (ms). Set to false to disable this.

changeOrder

Require a bool indicates whether the layer will be changed when being brought to front ( or clicked ).

dgsSetProperty(dgsElement,"changeOrder",changeOrder = true)
  • changeOrder: A bool indicates whether the layer will be changed when being brought to front ( or clicked ).

debugTrace

This property stores the "debug tracing data" includes in which lua file and line the specific dgs element created (Only available using loadstring(exports.dgs:dgsImportFunction())().

dgsSetProperty(dgsElement,"debugTrace",debugTrace)
  • debugTrace: A table stores creation data. Structure is as follows:
{
	file=filePath,
	line=lineNum,
	fncName=functionName,
}

enabled

Requires a bool value. This is equivalent to dgsSetEnabled/dgsGetEnabled.

dgsSetProperty(dgsElement,"enabled",enabled)
  • enabled: The state.

enableFullEnterLeaveCheck

Requires a bool value. This determines if target dgs element will have full check of mouse enter/leave. And you should use onDgsElementEnter/onDgsElementLeave instead of onDgsMouseEnter/onDgsMouseLeave.

dgsSetProperty(dgsElement,"enableFullEnterLeaveCheck",enableFullEnterLeaveCheck)
  • enableFullEnterLeaveCheck: The state.

functionRunBefore

Requires a bool value. Set whether the function runs before rendering or after rendering (see property functions).

dgsSetProperty(dgsElement,"functionRunBefore",functionRunBefore)
  • functionRunBefore: Set to true, and the function will run before rendering. Set to false, and the function will run after rendering.

functions

Requires a string at the 3rd argument. This property runs a function while rendering.

Predefine Variable

  • self: The DGS Element itself.

See example in dgsSetProperty

dgsSetProperty(dgsElement,"functions",fncString,arg1,arg2,...)
  • fncString: The string of function to be loaded.
  • arg1: argument 1
  • arg2: argument 2
  • ...: other arguments

childOutsideHit

Requires a bool value. Set whether children elements are clickable when they are outside of their parent element.

dgsSetProperty(dgsElement,"childOutsideHit",childOutsideHit = false)
  • childOutsideHit: If set to true, the dgsElement's child elements are clickable even though they are not inside the bounding box of dgsElement.

ignoreParentTitle

Requires a bool value. Set whether to ignore the title of dgs-dxwindow.

dgsSetProperty(dgsElement,"ignoreParentTitle",ignoreParentTitle = false)
  • ignoreParentTitle: Set to true to ignore the title of dgs-dxwindow if its parent is a dgs-dxwindow . Set to false to disable it, which means the y position of dgsElement in dgs-dxwindow will start to be calculated under the title.

mouseButtons

This property defines the specific mouse buttons that can be used to click on the element. Syntax:

dgsSetProperty(dgsElement, "mouseButtons", {bool left, bool right, bool middle})
  • left: Set this true to enable clicking with the left mouse button. Set it to false to disable clicking with the left mouse button.
  • right: Set this to true to enable clicking with the right mouse button. Set it to false to disable clicking with the right mouse button.
  • middle: Set this value to true to enable clicking with the middle mouse button. Set it to false to disable clicking with the middle mouse button.

outline

The border line of the bounding box of dgs element.

dgsSetProperty(dgsElement,"outline",{side,width,color,left,right,top,bottom})
  • side : A string indicates which side the outline will attach to. The available values are as follows:
    • in
    • center
    • out
  • width: The width of the outline.
  • color: The color of the outline, which can be transformed by tocolor.
  • left: Set true to show outline in the left, and false to hide it. (Default is true if not set)
  • right: Set true to show the outline in the right, and false to hide it. (Default is true if not set)
  • top: Set true to show the outline at the top, and false to hide it. (Default is true if not set)
  • bottom: Set true to show the outline at the bottom, and false to hide it. (Default is true if not set)

renderEventCall

Requires a bool value. Set whether onDgsElementRender is triggered when rendering. (Don't always enable this, or it will cause severely performance decrease)

dgsSetProperty(dgsElement,"renderEventCall",renderEventCall = false)
  • renderEventCall: Set to true to enable, and false to disable.

postGUI

Requires a bool value. Set whether the dgs element is post gui when render settings "postGUI" is nil(automatic).

dgsSetProperty(dgsElement,"postGUI",postGUI)
  • postGUI: Set to true to enable post gui, or it wil under gui.

visible

This property change the visibility of a dgs element. This is equivalent to dgsSetVisible/dgsGetVisible.

dgsSetProperty(dgsElement,"visible",visible)
  • visible: A bool indicates whether the dgs element is visible or not.

See Also

General Properties

Unique Properties For DGS Core Elements

Extra Properties For DGS Plugins