Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » One Main TopWindow and several others TopWindows, how? [SOLVED...]
One Main TopWindow and several others TopWindows, how? [SOLVED...] [message #1789] Sun, 19 March 2006 06:09 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
One Main TopWindow and several others "normal" TopWindows, how?

I need several normal TopWindows to run independantly but to be closable if Main window closes.

[Updated on: Sun, 09 April 2006 04:30]

Report message to a moderator

Re: One Main TopWindow and several others TopWindows, how? [message #1790 is a reply to message #1789] Sun, 19 March 2006 06:44 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Because this doesn't work:
#include <CtrlLib/CtrlLib.h>

GUI_APP_MAIN
{
	TopWindow w1;
	TopWindow w2;
	w1.SetRect(0,0,200,200);
		
	w1.Open();		
 	w1.Title("w1").Run(); //Activate() doesn't help either...
	
	w2.Open();		
	w2.Title("w2").Run();
}


[Updated on: Sun, 19 March 2006 06:50]

Report message to a moderator

Re: One Main TopWindow and several others TopWindows, how? [message #1793 is a reply to message #1790] Sun, 19 March 2006 07:17 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Btw, this-
 
w1.Open(NULL);

doesn't work either despite the
http://upp.sourceforge.net/src$CtrlCore$TopWindow$en-us.html

[Updated on: Sun, 19 March 2006 07:17]

Report message to a moderator

Re: One Main TopWindow and several others TopWindows, how? [message #1794 is a reply to message #1789] Sun, 19 March 2006 08:37 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
ok, I need something like this:
#include <CtrlLib/CtrlLib.h>

GUI_APP_MAIN
{
	TopWindow w1main;
	TopWindow w2;
	TopWindow w3;
			
	w1main.SetRect(0,0,100,100);
	w1main.OpenMain();		
	w1main.Title("w1main").Run();

	w2.SetRect(200,200,200,200);
	w2.Open(&w1main);		
	w2.Title("w2").Run();

	w3.SetRect(400,400,300,300);
	w3.Open(&w1main);		
	w3.Title("w3").Run();
}


How to make it work?
Re: One Main TopWindow and several others TopWindows, how? [message #1796 is a reply to message #1794] Sun, 19 March 2006 10:13 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Use OpenMain for all windows, but issue Run for the "main" window instead of Ctrl::EventLoop. That way, loop will be ended by closing the "main" window (and rest will get closed by destructors).

Mirek
Re: One Main TopWindow and several others TopWindows, how? [message #1797 is a reply to message #1793] Sun, 19 March 2006 10:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
fudadmin wrote on Sun, 19 March 2006 01:17

Btw, this-
 
w1.Open(NULL);

doesn't work either despite the
http://upp.sourceforge.net/src$CtrlCore$TopWindow$en-us.html


Just checked, it does, however above leads to ambiguity, you have to use

w1.Open((TopWindow*)NULL);

which is the same to what OpenMain does Smile

Mirek
Re: One Main TopWindow and several others TopWindows, how? [message #1799 is a reply to message #1796] Sun, 19 March 2006 10:38 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
luzr wrote on Sun, 19 March 2006 09:13

Use OpenMain for all windows, but issue Run for the "main" window instead of Ctrl::EventLoop. That way, loop will be ended by closing the "main" window (and rest will get closed by destructors).

Mirek


Thanks! This works now:
#include <CtrlLib/CtrlLib.h>

GUI_APP_MAIN
{
	TopWindow w1;
	TopWindow w2;
	TopWindow w3main;

	w1.SetRect(650,500,100,100);
	w1.OpenMain();		
	w1.Title("w1"); 
	
	w2.SetRect(400,300,200,200);
	w2.OpenMain();		
	w2.Title("w2");

	w3main.SetRect(50,50,300,300);
	w3main.OpenMain();		
	w3main.Title("w3main").Run();	//you must Run() the last one!		
	
}


Re: One Main TopWindow and several others TopWindows, how? [message #1800 is a reply to message #1799] Sun, 19 March 2006 10:42 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
The moral of the story is:

- Run loop is associated with single window, runs until the window is closed or the loop is explictly ended by the Break.

- Ctrl::EventLoop is not associated with any particular widow and keeps running as long as there are any windows open

Previous Topic: How to disable Maximize button on a dialog form? [SOLVED]
Next Topic: How do you use PopUp
Goto Forum:
  


Current Time: Thu Mar 28 11:47:15 CET 2024

Total time taken to generate the page: 0.01225 seconds