DgsSetSelectedTab

From Multi Theft Auto: Wiki

This function is used to change the currently selected tab in the specified dgs tab panel.

Syntax

bool dgsSetSelectedTab ( dgsElement tabPanel, dgsElement tab )

Required Arguments

  • tabPanel: The dgs tab panel which current tab you want to retrieve.
  • theTab: The dgs tab which will be the new active tab.

Returns

Returns true if the selected tab was changed to a new one successfully, false otherwise.

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

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Selector

Switch Button

Tab Panel

Window

Plugin

Blur Box

Color Picker

Canvas

Effect 3D

Media Browser

Mask

Nine Slice

Object Preview Supports

QRCode

Remote Image

Rounded Rectangle