DgsCreateTab

From Multi Theft Auto: Wiki
Revision as of 11:07, 16 February 2021 by XLive (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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