Home » U++ Library support » TabCtrl » TabCtrl feature request + patch 
	
		
		
			| TabCtrl feature request + patch [message #16547] | 
			Tue, 24 June 2008 17:36   | 
		 
		
			
				
				
				
					
						  
						zsolt
						 Messages: 702 Registered: December 2005  Location: Budapest, Hungary
						
					 | 
					Contributor   | 
					 | 
		 
		 
	 | 
 
	
		I would like to add a new method to set the active slave control. 
 
The situation is that maintaining data entry dialogs is very uncomfortable currently. 
 
The tabs are identified by indexes and after inserting a new tab, the programmer has to modify all the code setting tabs. 
 
In a data entry app, where every field is checked and focused on unexpected data, it is very easy to get incorrect behaviour after inserting a new tab. 
 
Being able to setting tabs based on slave controls would prevent this problem. 
 
the suggested patch: 
Index: TabCtrl.cpp
===================================================================
--- TabCtrl.cpp	(revision 303)
+++ TabCtrl.cpp	(working copy)
@@ -302,6 +302,16 @@
 	ScrollInto(sel);
 }
 
+void TabCtrl::SetActiveSlave(Ctrl& slave)
+{
+	for(int i = 0; i < tab.GetCount(); i++){
+		if(tab[i].slave == &slave){
+			Set(i);
+			return;
+		}
+	}
+}
+
 void TabCtrl::SetData(const Value& data)
 {
 	Set(data);
Index: TabCtrl.h
===================================================================
--- TabCtrl.h	(revision 303)
+++ TabCtrl.h	(working copy)
@@ -117,6 +117,7 @@
 	const Item& GetItem(int i) const             { return tab[i]; }
 
 	void Set(int i);
+	void SetActiveSlave(Ctrl& slave);
 	int  Get() const                             { return sel; }
 
 	void GoNext()                                { Go(1); }
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 07:40:45 CET 2025 
 Total time taken to generate the page: 0.05036 seconds 
 |