| 
 | 
 | 
 
Home » U++ Library support » TabCtrl » Missing API for what I need to do? 
	
		
		
			| Missing API for what I need to do? [message #14163] | 
			Sat, 16 February 2008 00:34   | 
		 
		
			
				
				
				
					
						  
						jlfranks
						 Messages: 57 Registered: May 2007  Location: Houston, TX, USA
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	
		I have a TabCtrl populated with five tabs using  
    TabCtrl::Item& Add(Ctrl& slave, const char *text) 
 
We need a special behavior for the control that happens to 
be index 4. I sense the tab Action with a callback. I don't 
know which tab is selected except by index. So, my magic 
number 4 is supposed to be related to the special object that requires additional handling. The problem is that I have 
no way to verify that in the callback. There seems to be no 
way to get at the slave control and make a comparison to 
the control of interest for special handling. 
 
If the order of the tab pages change (other programmers, etc.), 
callback will be doing the wrong thing. There seems to be no 
way to determine that the current selected item is the one of interest. 
 
Somehow, I expected to have an API that I could get at the 
slave object, test it, and perhaps apply special handling if 
it is the object of interest. 
 
Is there some way of doing this with the API already in place? 
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: Missing API for what I need to do? [message #15823 is a reply to message #15063] | 
			Thu, 08 May 2008 21:40    | 
		 
		
			
				
				
				
					
						  
						zsolt
						 Messages: 702 Registered: December 2005  Location: Budapest, Hungary
						
					 | 
					Contributor   | 
					 | 
		 
		 
	 | 
 
	
		I have tried your changes, but they are not working. 
 
The problem is, that in your code you return ctrl instead of slave, but ctrl member seems to be used only by some dead code in TabCtrl. 
 
Could you change it to slave? Or add a new GetSlave() method returning slave? 
 
Maybe it would be useful to remove ctrl member also.
		
		
		[Updated on: Thu, 08 May 2008 21:41] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: Missing API for what I need to do? [message #15915 is a reply to message #15823] | 
			Thu, 15 May 2008 22:41   | 
		 
		
			
				
				
				
					
						  
						zsolt
						 Messages: 702 Registered: December 2005  Location: Budapest, Hungary
						
					 | 
					Contributor   | 
					 | 
		 
		 
	 | 
 
	
		What about this topic? Here is the patch: 
 
Index: TabCtrl.h
===================================================================
--- TabCtrl.h	(revision 254)
+++ TabCtrl.h	(working copy)
@@ -47,6 +47,8 @@
 		Item&          Enable(bool _en = true);
 		Item&          Disable()                        { return Enable(false); }
 		bool           IsEnabled() const                { return enabled; }
+		Ctrl          *GetSlave()                       { return slave; }
+		const Ctrl    *GetSlave() const                 { return slave; }
 		Ctrl          *GetCtrl()                        { return ctrl; }
 		const Ctrl    *GetCtrl() const                  { return ctrl; }
 
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 07:39:54 CET 2025 
 Total time taken to generate the page: 0.05084 seconds 
 |   
 |  
  |