Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TabBar is not scrolled to correct position

    Hi,

    I have a problem that TabBar is not scrolled to correct position when the selected tab is set before the TabSet is drawn. It happens when the tab-button of the tab being selected is not directly visible (as there are to many tabs).

    Sample code:
    Code:
    public void onModuleLoad() {
    	final TabSet tabSet = new TabSet();  
    	tabSet.setTabBarPosition(Side.TOP);  
    	tabSet.setWidth(400);  
    	tabSet.setHeight(200);  
    
    	for (int i=0; i<10;i++) {
    		Tab tab = new Tab("Tab "+i);
    		Label lbl = new Label("Label "+i);
    		tab.setPane(lbl);
    		tabSet.addTab(tab);
    	}
    
    	// tab is selected but TabBar is not scrolled to show the tab-button
    	tabSet.selectTab(7);   
    	IButton addButton = new IButton("select tab 8");  
    	addButton.addClickHandler(new ClickHandler() {  
    		public void onClick(ClickEvent event) {
    			// tab is selected and TabBar scrolled to correct position
    			tabSet.selectTab(8);
    		}  
    	});  
    	VLayout vLayout = new VLayout();  
    	vLayout.setMembersMargin(15);  
    	vLayout.addMember(tabSet);  
    	vLayout.addMember(addButton);  
    	vLayout.setAutoHeight();  
    
    	vLayout.draw();  
    }
    How can I set the selected tab during initialization to be the TabBar correctly scrolled?

    Thanks in advance

    Svatya

    SmartGWT: 2.2 LGPL
    Browsers: IE8, FF 3.6.13
Working...
X