DgsCreateTab: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(update arguments names)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element dgsCreateTab ( string text, element parent [,int scaleX = 1, int scaleY = 1, int textColor = 0xFFFFFFFF, element bgImage = nil, int bgColor = 0x000000C8, element nImage = nil, element hImage = nil, element cImage = nil, int nColor = 282828B4, int tabhovcolor = 0x505050BE, int cColor = 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 19: Line 19:
*'''bgImage:''' An image element of the background image of the panel of the tab.
*'''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.
*'''bgColor:''' An integer of the background color of the panel of the tab.
*'''nImage:''' An image element of the background image of the tab (default state).
*'''normalImage:''' An image element of the background image of the tab (default state).
*'''hImage:''' An image element of the background imag  of the tab (hovered state).
*'''hoveringImage:''' An image element of the background imag  of the tab (hovered state).
*'''cImage:''' An image element of the background image of the tab (clicked state).
*'''clickedImage:''' An image element of the background image of the tab (clicked state).
*'''nColor:''' An integer of the background color of the tab (default state).
*'''normalColor:''' An integer of the background color of the tab (default state).
*'''hColor:''' An integer of the background color of the tab (hovered state).
*'''hoveringColor:''' An integer of the background color of the tab (hovered state).
*'''cColor:''' An integer of the background color of the tab (clicked state).
*'''clickedColor:''' An integer of the background color of the tab (clicked state).


===Returns===
===Returns===

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