Home » U++ Library support » TabCtrl » How to highlight particular tab when corresponding button is clicked 
	
		
		
			| How to highlight particular tab when corresponding button is clicked [message #33080] | 
			Wed, 06 July 2011 07:53   | 
		 
		
			
				
				
				
					
						  
						Monty.mvh
						 Messages: 31 Registered: July 2011  Location: Bangalore
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi friends, 
 I have 5 tabs and each tab has its own button.. 
When a particular button is clicked ,corresponding tab has to get opened and set..But problem is am able to open the tab by clicking the button but only tab 1 is getting highlighted while other tabs after opening thru respective buttons remain in the background... 
 
What is the function i need to call to set particular tab when corresponding button is clicked...
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: How to highlight particular tab when corresponding button is clicked [message #33135 is a reply to message #33080] | 
			Sun, 10 July 2011 13:10    | 
		 
		
			| 
				
	 | 
 
	
		Hi Monty! 
 
I'm not sure if I understand correctly... Do you mean something like this? #include <CtrlLib/CtrlLib.h>
using namespace Upp;
class App:public TopWindow {
	typedef App CLASSNAME;
	TabCtrl tabs;
	Button b1,b2,b3;
	Label c1,c2,c3;
public:
	App(){
		c1.SetLabel("Content of tab 1 ...");
		c2.SetLabel("Content of tab 2 ...");
		c3.SetLabel("Content of tab 3 ...");
		
		Add(tabs.VSizePos(30).HSizePos());
		tabs.Add(c1.SizePos(),"Tab 1");
		tabs.Add(c2.SizePos(),"Tab 2");
		tabs.Add(c3.SizePos(),"Tab 3");
		Add(b1.TopPos(5,20).LeftPos(  5,50));
		Add(b2.TopPos(5,20).LeftPos( 60,50));
		Add(b3.TopPos(5,20).LeftPos(115,50));
		b1.SetLabel("Set 1");
		b2.SetLabel("Set 2");
		b3.SetLabel("Set 3");
		
		b1<<=THISBACK1(SetTab,0);
		b2<<=THISBACK1(SetTab,1);
		b3<<=THISBACK1(SetTab,2);
	}
	void SetTab(int n){
		tabs.Set(n);
	}
};
GUI_APP_MAIN{
	App().Sizeable().Run();
} 
 
If I didn't get it right, please try to explain you problem once more... 
 
Best regards, 
Honza
		
		
		[Updated on: Sun, 10 July 2011 13:41] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 15:33:07 CET 2025 
 Total time taken to generate the page: 0.06643 seconds 
 |