DgsGetSelectedTab

From Multi Theft Auto: Wiki

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

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

Edit

Ellipse Detect Area

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Switch Button

Tab Panel

Window

Plugin

Media Browser

Rounded Rectangle

Color Picker

Blur Box

Effect 3D