DgsCreateTabPanel: Difference between revisions
Jump to navigation
Jump to search
(→image) |
No edit summary |
||
Line 16: | Line 16: | ||
*'''tabheight:''' It's the Height of your tabs, Default is 20. | *'''tabheight:''' It's the Height of your tabs, Default is 20. | ||
*'''defbcolor:''' It's the Color of the backround. | *'''defbcolor:''' It's the Color of the backround. | ||
<section name="Example 1: Client" class="client" show="true"> | |||
This script show a tab panel by a BindKey(F2). | |||
<syntaxhighlight lang="lua"> | |||
DGS = exports.dgs | |||
matable = {} | |||
matable.tab = DGS:dgsDxCreateTabPanel (0.22, 0.19, 0.56, 0.63,true) | |||
matable.tab1 = DGS:dgsDxCreateTab("Main",matable.tab) | |||
matable.tab1 = DGS:dgsDxCreateTab("Rules",matable.tab) | |||
matable.tab1 = DGS:dgsDxCreateTab("FAQ",matable.tab) | |||
matable.tab1 = DGS:dgsDxCreateTab("About Us",matable.tab) | |||
function guiToggleVisible ( ) | |||
if ( DGS:dgsDxGUIGetVisible (matable.tab) == true ) then -- check if the dgs element is visible | |||
DGS:dgsDxGUISetVisible (matable.tab, false ) -- if it is, we hide it | |||
showCursor(false) | |||
print("works2") | |||
else | |||
DGS:dgsDxGUISetVisible (matable.tab, true ) -- if not, we make it visible | |||
showCursor(true) | |||
print("works3") | |||
end | |||
end | |||
bindKey ( "F2", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible | |||
</syntaxhighlight> | |||
</section> |
Revision as of 14:02, 12 August 2017
This function allows creation of a DGS Tab Panel.
Syntax
element dgsDxCreateTabPanel( float x, float y, float width, float height, bool relative, [ element parent = nil, element tabheight = 20, defbgcolor = ])
Required Arguments
- x: A float of the 2D x position of the DGS Tab Panel on a player's screen. This is affected by the relative argument.
- y: A float of the 2D y position of the DGS Tab Panel on a player's screen. This is affected by the relative argument.
- width: A float of the width of the DGS Tab Panel. This is affected by the relative argument.
- height: A float of the height of the DGS Tab Panel. This is affected by the relative argument. Note: height must be enough to fit the drop down menu, else the drop down won't appear.
- relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.
Optional Arguments
- parent: This is the parent that the DGS Panel is attached to.
- tabheight: It's the Height of your tabs, Default is 20.
- defbcolor: It's the Color of the backround.
Click to collapse [-]
Example 1: ClientThis script show a tab panel by a BindKey(F2).
DGS = exports.dgs matable = {} matable.tab = DGS:dgsDxCreateTabPanel (0.22, 0.19, 0.56, 0.63,true) matable.tab1 = DGS:dgsDxCreateTab("Main",matable.tab) matable.tab1 = DGS:dgsDxCreateTab("Rules",matable.tab) matable.tab1 = DGS:dgsDxCreateTab("FAQ",matable.tab) matable.tab1 = DGS:dgsDxCreateTab("About Us",matable.tab) function guiToggleVisible ( ) if ( DGS:dgsDxGUIGetVisible (matable.tab) == true ) then -- check if the dgs element is visible DGS:dgsDxGUISetVisible (matable.tab, false ) -- if it is, we hide it showCursor(false) print("works2") else DGS:dgsDxGUISetVisible (matable.tab, true ) -- if not, we make it visible showCursor(true) print("works3") end end bindKey ( "F2", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible