DgsCreateTab: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element dgsDxCreateTab ( string text, element parent [,int scalex = 1, int scaley = 1, int textcolor = 0xFFFFFFFF, element bgimg = nil, int bgcolor = 0x000000C8, element tabdefimg = nil, element tabhovimg = nil, element tabcliimg = nil, int tabdefcolor = 282828B4, int tabhovcolor = 0x505050BE, int tabclicolor = 0X000000C8])
element dgsCreateTab ( string text, element parent [,int scaleX = 1, int scaleY = 1, int textColor = 0xFFFFFFFF, element bgImage = nil, int bgColor = 0x000000C8, element normalImage = nil, element hoveringImage = nil, element clickedImage = nil, int normalColor = 282828B4, int hoveringColor = 0x505050BE, int clickedColor = 0X000000C8])
</syntaxhighlight>  
</syntaxhighlight>  


Line 14: Line 14:


==Optional Arguments==
==Optional Arguments==
*'''scalex:''' A float of the 2D x scale of the text of the tab.
*'''scaleX:''' A float of the 2D x scale of the text of the tab.
*'''scaley:''' A float of the 2D y scale of the text of the tab.
*'''scaleY:''' A float of the 2D y scale of the text of the tab.
*'''bgimg:''' An image element of the background image of the panel of the tab.
*'''textColor:''' An int of the color of the text color.
*'''bgcolor:''' An integer of the background color of the panel of the tab.
*'''bgImage:''' An image element of the background image of the panel of the tab.
*'''tabdefimg:''' An image element of the background image of the tab (default state).
*'''bgColor:''' An integer of the background color of the panel of the tab.
*'''tabhovimg:''' An image element of the background imag  of the tab (hovered state).
*'''normalImage:''' An image element of the background image of the tab (default state).
*'''tabcliimg:''' An image element of the background image of the tab (clicked state).
*'''hoveringImage:''' An image element of the background imag  of the tab (hovered state).
*'''tabdefcolor:''' An integer of the background color of the tab (default state).
*'''clickedImage:''' An image element of the background image of the tab (clicked state).
*'''tabselcolor:''' An integer of the background color of the tab (hovered state).
*'''normalColor:''' An integer of the background color of the tab (default state).
*'''tabclicolor:''' An integer of the background color of the tab (clicked state).
*'''hoveringColor:''' An integer of the background color of the tab (hovered state).
*'''clickedColor:''' An integer of the background color of the tab (clicked state).


===Returns===
===Returns===
Line 31: Line 32:
This example creates a information window and adds two tabs to a "tabPanel" tabpanel, and adds some other dgs elements to it.
This example creates a information window and adds two tabs to a "tabPanel" tabpanel, and adds some other dgs elements to it.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
DGS = exports.dgs
loadstring(exports.dgs:dgsImportFunction())()
local myWindow = DGS:dgsDxCreateWindow ( 0, 0, 0.5, 0.4, "Information", true )--create a window which has "Information" in the title bar.
 
local tabPanel = DGS:dgsDxCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) --create a tab panel which fills the whole window
local myWindow = dgsCreateWindow ( 0, 0, 0.5, 0.4, "Information", true )--create a window which has "Information" in the title bar.
local tabMap = DGS:dgsDxCreateTab( "Map Information", tabPanel ) -- create a tab named "Map Information" on 'tabPanel'
local tabPanel = dgsCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) --create a tab panel which fills the whole window
local tabHelp = DGS:dgsDxCreateTab( "Help", tabPanel ) -- create another tab named "Help" on 'tabPanel'
local tabMap = dgsCreateTab( "Map Information", tabPanel ) -- create a tab named "Map Information" on 'tabPanel'
local tabHelp = dgsCreateTab( "Help", tabPanel ) -- create another tab named "Help" on 'tabPanel'


-- adds a label (text) to each tab
-- adds a label (text) to each tab
DGS:dgsDxCreateLabel(0.02,0.04,0.94,0.2,"This is information about the current map",true,tabMap)
dgsCreateLabel(0.02,0.04,0.94,0.2,"This is information about the current map",true,tabMap)
DGS:dgsDxCreateLabel(0.02,0.04,0.94,0.92,"This is help text.",true,tabHelp)
dgsCreateLabel(0.02,0.04,0.94,0.92,"This is help text.",true,tabHelp)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{DGSFUNCTIONS}}
{{DGSFUNCTIONS}}

Latest revision as of 11:07, 16 February 2021

This function creates a tab on a pre-existing tab panel. A tab is a button as well as a 'dimension' that can be used to switch between information by clicking on the tabs. Tabs are sorted on a tab panel in the order that they are created.

Syntax

element dgsCreateTab ( string text, element parent [,int scaleX = 1, int scaleY = 1, int textColor = 0xFFFFFFFF, element bgImage = nil, int bgColor = 0x000000C8, element normalImage = nil, element hoveringImage = nil, element clickedImage = nil, int normalColor = 282828B4, int hoveringColor = 0x505050BE, int clickedColor = 0X000000C8])

Required Arguments

Example tab panel with two tabs.
  • text: The caption for the tab
  • parent: The parent tab panel, as a tab panel element type

Optional Arguments

  • scaleX: A float of the 2D x scale of the text of the tab.
  • scaleY: A float of the 2D y scale of the text of the tab.
  • textColor: An int of the color of the text color.
  • bgImage: An image element of the background image of the panel of the tab.
  • bgColor: An integer of the background color of the panel of the tab.
  • normalImage: An image element of the background image of the tab (default state).
  • hoveringImage: An image element of the background imag of the tab (hovered state).
  • clickedImage: An image element of the background image of the tab (clicked state).
  • normalColor: An integer of the background color of the tab (default state).
  • hoveringColor: An integer of the background color of the tab (hovered state).
  • clickedColor: An integer of the background color of the tab (clicked state).

Returns

Returns a dgs-dxtab element if successful, false otherwise.

Example

This example creates a information window and adds two tabs to a "tabPanel" tabpanel, and adds some other dgs elements to it.

loadstring(exports.dgs:dgsImportFunction())()

local myWindow = dgsCreateWindow ( 0, 0, 0.5, 0.4, "Information", true )--create a window which has "Information" in the title bar.
local tabPanel = dgsCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) --create a tab panel which fills the whole window
local tabMap = dgsCreateTab( "Map Information", tabPanel ) -- create a tab named "Map Information" on 'tabPanel'
local tabHelp = dgsCreateTab( "Help", tabPanel ) -- create another tab named "Help" on 'tabPanel'

-- adds a label (text) to each tab
dgsCreateLabel(0.02,0.04,0.94,0.2,"This is information about the current map",true,tabMap)
dgsCreateLabel(0.02,0.04,0.94,0.92,"This is help text.",true,tabHelp)

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