Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

TabSet, baseline still visible on hidden TabBar

$
0
0
Hi folks,

we are using (may be quite specific) behavior for the TabSet component: when there is only one Tab visible, the TabBar (autoChild component) is hidden to not show the single Tab.

This worked quite well for years. But after upgrade to SmartGWT 5.0p, SmartClient Version: v10.0p_2015-02-24/LGPL Development Only (built 2015-02-24), there is a problem with the "baseLine", which remains visible.

I've been able to reproduce it also in the SC showcase on the current build, with minor modifications (see the attached screenshot):
http://www.smartclient.com/#closeableTabs

This is the modified code for the closeableTabs example (simulating behavior described above):
Code:

isc.TabBar.addProperties({
                baseLineConstructor:"Canvas",
                baseLineProperties : {
                    backgroundColor: "pink",
                    overflow:"hidden"
                },
                baseLineThickness:1
 });

isc.TabSet.create({
    ID: "tabSet",
    tabBarPosition: "top",
    width: 400,
    height: 200,
    tabs: [
        {title: "Blue", canClose: true,
        pane: isc.Img.create({autoDraw: false, width: 48, height: 48, src: "pieces/48/pawn_blue.png"})},
        {title: "Green",
        pane: isc.Img.create({autoDraw: false, width: 48, height: 48, src: "pieces/48/pawn_green.png"})}
    ],
    hideTabBar : function () {
                if(this && this.tabBar) {
                  var tmpTabBarHeight = this.tabBar.getHeight();
                  this.tabBarOverlap = tmpTabBarHeight;
                  this.tabBar.hide();
                  this.fixLayout();
                }
            },
    showTabBar : function () {
        if(this && this.tabBar) {
          this.tabBarOverlap = null;
          this.tabBar.show();
          this.fixLayout();
        }
    }
});

isc.HLayout.create({
    top: 215,
    membersMargin: 15,
    members: [
        isc.IButton.create({
            title: "Add Tab",
            click: function () {
                // alternate between yellow pawn and green cube
                if (tabSet.tabs.length % 2 == 0) {
                    tabSet.addTab({
                        title: "Yellow",
                        canClose: true,
                        pane: isc.Img.create({autoDraw: false, width: 48, height: 48,
                                              src: "pieces/48/pawn_yellow.png"})
                    });
                } else {
                    tabSet.addTab({
                        title: "Green",
                        canClose: true,
                        pane: isc.Img.create({autoDraw: false, width: 48, height: 48,
                                              src: "pieces/48/cube_green.png"})
                    });           
                }
                if (tabSet.tabs.length == 1) tabSet.selectTab(0);
                if (tabSet.tabs.length > 1) tabSet.showTabBar();
            }
        }),
        isc.IButton.create({
            title: "Remove Tab",
            click: function () {
                tabSet.removeTab(tabSet.tabs.length-1);
                if (tabSet.tabs.length == 1) {
                    tabSet.hideTabBar();
                }
            }
        })
    ]
});

Any hint would be appreciated.

Attached Images
File Type: png baseLine_remains_visible.PNG (10.6 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles