DgsCreateTabPanel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTIC__
{{Client function}}
 
__NOTOC__
This function allows creation of a DGS Tab Panel.
This function allows creation of a DGS Tab Panel.
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element dgsDxCreateTabPanel( float x, float y, float width, float height, bool relative, [ element parent = nil, element tabheight = 20, defbgcolor = ])
element dgsCreateTabPanel( float x, float y, float width, float height, bool relative [, element parent = nil, int tabHeight = 20, element bgImage = nil, int bgColor = 0xB4000000 ] )
</syntaxhighlight>
</syntaxhighlight>


Line 13: Line 13:
*'''width:''' A float of the width of the DGS Tab Panel. 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.
*'''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.
*'''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===
===Optional Arguments===
*'''parent:''' This is the parent that the DGS Panel is attached to.  
*'''parent:''' This is the parent that the DGS Panel is attached to.  
*'''tabheight:''' It's the Height of your tabs, Default is 20.
*'''tabHeight:''' A int of the height of the tab.
*'''defbcolor:''' It's the Color of the backround.
*'''bgImage:''' A material element that is used as default background of tab panel.
*'''bgColor:''' A int of color that is used as default background color of tab panel.


==Example==
==Example==
Line 24: Line 25:
DGS = exports.dgs
DGS = exports.dgs
matable = {}
matable = {}
matable.tab = DGS:dgsDxCreateTabPanel (0.22, 0.19, 0.56, 0.63,true)
matable.tab = DGS:dgsCreateTabPanel (0.22, 0.19, 0.56, 0.63,true)
matable.tab1 = DGS:dgsDxCreateTab("Main",matable.tab)
matable.tab1 = DGS:dgsCreateTab("Main",matable.tab)
matable.tab2 = DGS:dgsDxCreateTab("Rules",matable.tab)
matable.tab2 = DGS:dgsCreateTab("Rules",matable.tab)
matable.tab3 = DGS:dgsDxCreateTab("FAQ",matable.tab)
matable.tab3 = DGS:dgsCreateTab("FAQ",matable.tab)
matable.tab4 = DGS:dgsDxCreateTab("About Us",matable.tab)
matable.tab4 = DGS:dgsCreateTab("About Us",matable.tab)
 
 
 
 


function guiToggleVisible ( )         
function guiToggleVisible ( )         
        if ( DGS:dgsDxGUIGetVisible (matable.tab) == true ) then -- check if the dgs element is visible               
if ( DGS:dgsGetVisible (matable.tab) == true ) then -- check if the dgs element is visible               
                DGS:dgsDxGUISetVisible (matable.tab, false ) -- if it is, we hide it
DGS:dgsSetVisible (matable.tab, false ) -- if it is, we hide it
showCursor(false)
showCursor(false)
print("works2")
print("works2")
        else               
else               
                DGS:dgsDxGUISetVisible (matable.tab, true ) -- if not, we make it visible
DGS:dgsSetVisible (matable.tab, true ) -- if not, we make it visible
showCursor(true)
showCursor(true)
print("works3")
print("works3")
        end
end
end
end


Line 49: Line 46:
</syntaxhighlight>
</syntaxhighlight>
Example Create by :'''Ridden'''
Example Create by :'''Ridden'''
==See Also==
{{DGSFUNCTIONS}}

Latest revision as of 09:27, 17 January 2021

This function allows creation of a DGS Tab Panel.

Syntax

element dgsCreateTabPanel( float x, float y, float width, float height, bool relative [, element parent = nil, int tabHeight = 20, element bgImage = nil, int bgColor = 0xB4000000 ] )
Example DGS Tab Panel.

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: A int of the height of the tab.
  • bgImage: A material element that is used as default background of tab panel.
  • bgColor: A int of color that is used as default background color of tab panel.

Example

This example creates tab panel with a BindKey which is F2

DGS = exports.dgs
matable = {}
matable.tab = DGS:dgsCreateTabPanel (0.22, 0.19, 0.56, 0.63,true)
matable.tab1 = DGS:dgsCreateTab("Main",matable.tab)
matable.tab2 = DGS:dgsCreateTab("Rules",matable.tab)
matable.tab3 = DGS:dgsCreateTab("FAQ",matable.tab)
matable.tab4 = DGS:dgsCreateTab("About Us",matable.tab)

function guiToggleVisible ( )        
	if ( DGS:dgsGetVisible (matable.tab) == true ) then -- check if the dgs element is visible               
		DGS:dgsSetVisible (matable.tab, false ) -- if it is, we hide it
		showCursor(false)
		print("works2")
	else              
		DGS:dgsSetVisible (matable.tab, true ) -- if not, we make it visible
		showCursor(true)
		print("works3")
	end
end

bindKey ( "F2", "down", guiToggleVisible ) --bind the player's F2 to the function guiToggleVisible

Example Create by :Ridden

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