Home » U++ Library support » TopWindow&PopUp, TrayIcon » How to handle child windows 
	
		
		
			| How to handle child windows [message #9508] | 
			Sun, 13 May 2007 00:46   | 
		 
		
			
				
				
				  | 
					
						  
						michael
						 Messages: 153 Registered: May 2007  Location: Germany
						
					 | 
					Experienced Member  | 
					 | 
		 
		 
	 | 
 
	
		Lets say i want to open an child window for dispaying some help context. A help window. 
 
I would like to open this new window by pressing a button on my main TopWindow. 
 
How do i have to create this new Window and how do i have to add some components like labels, buttons, etc. on this new window? 
 
I tried the example with multipe TopWindows but is this the right way to handle windows like this? 
 
I need some basic example on how to create a child windows from a topwindow. 
 
Thanks in advance. 
 
Michael
		
		
		[Updated on: Sun, 13 May 2007 00:57] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: How to handle child windows [message #9698 is a reply to message #9695] | 
			Fri, 25 May 2007 11:02    | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		| michael wrote on Fri, 25 May 2007 03:33 |   Is there a way to get the topwindow position and then place a new window relative to the main topwindow, like this? 
 
SetRect(mainWndX + 10, mainWndY + 10, 300, 300);  
Michael
  |  
  
 
Yes, GetRect(). For this purpose, top-level windows are considered "desktop children". 
 
One thing you need to know, however: TopLevel window positions are positions without "decorations" provided by host-os, means window caption and thick frame are "outside" this position.
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	
		
		
			| Re: How to handle child windows [message #9700 is a reply to message #9699] | 
			Fri, 25 May 2007 14:09    | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		| michael wrote on Fri, 25 May 2007 05:58 |   Ok, that works. 
 
But how can i use GetRect to get only the position, not the size? 
 
I only want to get the x-pos, the y-pos of the topwindow and set it on the childwindow with SetRect(x-pos, y-pos, 300, 400); 
 
GetRect delivers the complete Position and Size of the topwindow, how can i split these information? 
 
Michael
  |  
  
 
E.g. 
 
Rect r;
Point p(r.left, r.top);
Point p = r.TopLeft();
Size sz = r.GetSize();
  
etc... 
 
Note: Press Ctrl+Q and type there "Rect". Or go to Rect id in sources and press Alt+J. (Parser is not perfect yet, but usually it works...) 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 17:04:22 CET 2025 
 Total time taken to generate the page: 0.05563 seconds 
 |