DgsGetSelectedTab

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function returns the currently selected tab in the specified dgs tab panel.

Syntax

dgsElement dgsGetSelectedTab ( dgsElement tabPanel )

Required Arguments

  • tabPanel: The dgs tab panel which current tab you want to retrieve.

Returns

Returns a dgsElement of the dgs-dxtab if a tab was selected or nil if no tab was selected. If passed arguments were invalid or something went wrong, the function will return false.

Example

This example gets the current selected tab and sets the selected tab to the next available tab.

DGS = exports.dgs
local tabPanel = DGS:dgsCreateTabPanel ( 0, 0.1, 1, 1, true) --create a tab panel which fills the whole window
local tab1 = DGS:dgsCreateTab("Welcome",tabPanel) --create a tab for the tab panel above
local tab2 = DGS:dgsCreateTab("Info",tabPanel)--create another tab for the tab panel at the top

function check()
   if(DGS:dgsGetSelectedTab(tabPanel)==tab1)then --Check what tab is currently shown
      DGS:dgsSetSelectedTab(tabPanel,tab2) --if the "Welcome" tab is selected, change it to tab2("Info" tab)
   else
      DGS:dgsSetSelectedTab(tabPanel,tab1) --if the "Info" tab is selected, change it to tab1("Welcome" tab)
   end
end

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

Plugin

Blur Box

Canvas

Chart

Circle

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Rounded Rectangle

Screen Source

SVG

Tooltips