Search code examples
smartclient

Open a TabSet to a specific Tab


By default the first tab becomes selected when a TabSet is drawn

I'm curious to know if it's possible to instead set the initial tab to be tab at index 2, 3, etc.


Solution

  • You may set TabSet.selectedTab:

    Specifies the index of the initially selected tab.

    a sample:

    isc.TabSet.create({
        ID: "topTabSet",
        tabBarPosition: "top",
        width: 400,
        height: 200,
        selectedTab:1,
        tabs: [
            {title: "Blue", icon: "pieces/16/pawn_blue.png", iconSize:16,
             pane: isc.Img.create({autoDraw: false, width: 48, height: 48, src: "pieces/48/pawn_blue.png"})},
            {title: "Green", icon: "pieces/16/pawn_green.png", iconSize:16,
             pane: isc.Img.create({autoDraw: false, width: 48, height: 48, src: "pieces/48/pawn_green.png"})}
        ]
    });