Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26th Oct 2010, 08:13
heavenite heavenite is offline
Registered Developer
 
Join Date: Jan 2010
Posts: 60
Default Hide tab from a TabSet

Is there anyway to hide a tab which was already added to a TabSet ?
Reply With Quote
  #2  
Old 26th Oct 2010, 10:21
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 38,663
Default

Use removeTab(). There isn't a way to hide the tab, just re-add the same tab with addTab() later if you want it again.
Reply With Quote
  #3  
Old 10th Apr 2012, 05:09
mi0 mi0 is offline
Registered Developer
 
Join Date: Jun 2011
Posts: 12
Default

Hello,

I will bring this thread back to life, because removing tab from tabset will cause: "The pane associated with the removed tab is automatically destroyed... To avoid this, call updateTab with null as the new pane immediately before removing the tab.".

But, setting null as new pane for tab will cause override old pane (obviously) so you have keep old pane for later re-use. I am right?

Little example:
Code:
	public void onModuleLoad() {
		final TabSet ts = new TabSet();
		ts.setSize("400px", "400px");
		Tab tab1 = new Tab();
		Button add = new Button("Add");
		tab1.setPane(add);
		
		final Tab tab2 = new Tab();
		final Button rem = new Button("Remove");
		tab2.setPane(rem);
		ts.addTab(tab1);
		ts.addTab(tab2);
		ts.show();
		add.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				tab2.setPane(rem);
				ts.addTab(tab2); 
			}
		});
		rem.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				ts.updateTab(tab2, null);
				ts.removeTab(tab2); 
			}
		});
		
	}
..or, it's here some better solution to hide/show tabs in tabset? E.g. create more tabsets with desired tabs without need of hiding them? (and can I use same tab in multiple tabsets or have I create its clones)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved