Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » simple  TopWindow... branch GUI_APP_MAIN 
	
		
		
			| simple  TopWindow... branch GUI_APP_MAIN [message #212] | 
			Sat, 03 December 2005 14:14   | 
		 
		
			
				
				
				  | 
					
						  
						fudadmin
						 Messages: 1321 Registered: November 2005  Location: Kaunas, Lithuania
						
					 | 
					Ultimate Contributor Administrator  | 
					 | 
		 
		 
	 | 
 
	
		if it helps for the beginners... 
start learning.. 
Step 1 .the minimal    ? gui program in U++:  
"titleless Window": 
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
    TopWindow().Run();  //creates, opens and starts pumping messages...
}
 
 
2. let's make much more sophisticated- "title1 Window": 
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
    TopWindow().Title("title1").Run();  //creates window and its title, opens and starts pumping messages...
}
 
 
3. "title1 Window, Zoomable,Sizeable": 
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
    TopWindow().Title("title1").Zoomable().Sizeable().Run();  //creates window and its title, opens and starts pumping messages...
}
 
 
4. a) "title1 Window, setRect" this way doesn't work: 
 
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
    TopWindow().Title("title1").SetRect(0, 0, 260, 80).Run();  // should create window and its title, open and start pumping messages... but
//error C2228: left of '.Run' must have class/struct/union type
        type is 'void'
}
 
 
Why? I don't know. We need to ask the creators... 
 
But it works in the next examples I'm going to put in a different  topic. So, watch the space...    
 
Edited: 
4 b) "title1 Window, setRect" - it works like this: 
 
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
    TopWindow().Title("title1").Run();
    TopWindow().SetRect(0, 0, 260, 80);
}
 
		
		
		[Updated on: Sat, 03 December 2005 17:28] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: simple  TopWindow... branch GUI_APP_MAIN [message #227 is a reply to message #212] | 
			Sun, 04 December 2005 19:01   | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		| fudadmin wrote on Sat, 03 December 2005 08:14 |  
  
4. a) "title1 Window, setRect" this way doesn't work: 
 
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
    TopWindow().Title("title1").SetRect(0, 0, 260, 80).Run();  // should create window and its title, open and start pumping messages... but
//error C2228: left of '.Run' must have class/struct/union type
        type is 'void'
}
 
 
Why? I don't know. We need to ask the creators... 
  |  
  
 
Because SetRect is method of Ctrl, not TopWindow and it returns "void". Therefore: 
 
TopWindow win; 
win.Title("Title"); 
win.SetRect(0, 0, 260, 80); 
win.Run(); 
 
Actually, what methods are supposed to return *this for method chaining is debatable. Usually they are "property" methods (or "modifiers") that are used to setup some initial state. 
		
		
		
 |  
	| 
		
	 | 
 
 
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 10:54:13 CET 2025 
 Total time taken to generate the page: 0.06146 seconds 
 |