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 » How to handle child windows
How to handle child windows [message #9508] Sun, 13 May 2007 00:46 Go to next message
michael is currently offline  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 #9510 is a reply to message #9508] Sun, 13 May 2007 10:00 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
michael wrote on Sun, 13 May 2007 00:46

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


Hello,

for a help window just use

HelpWindow a;
a.Execute();

For a non modal window see section 22 of http://www.ultimatepp.org/srcdoc$CtrlLib$Tutorial$en-us.html

Hope this can help.

Luigi
Re: How to handle child windows [message #9512 is a reply to message #9508] Sun, 13 May 2007 13:13 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
Thank you Luigi, your hint about Section 22 of the GUI-Tutorial shows what i was looking for. Works fine.

Michael
Re: How to handle child windows [message #9695 is a reply to message #9508] Fri, 25 May 2007 09:33 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
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
Re: How to handle child windows [message #9698 is a reply to message #9695] Fri, 25 May 2007 11:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
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 #9699 is a reply to message #9508] Fri, 25 May 2007 11:58 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
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
Re: How to handle child windows [message #9700 is a reply to message #9699] Fri, 25 May 2007 14:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
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...)
Re: How to handle child windows [message #9712 is a reply to message #9508] Sat, 26 May 2007 20:22 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
And how can i use it when calling SetRect from a childwindow?

SetRect(mainWnd.GetRect().left + 20, mainWnd.GetRect().top + 20, wndWidth, wndHeight);

didn't work.

Michael

[Updated on: Mon, 28 May 2007 13:06]

Report message to a moderator

Re: How to handle child windows [message #9723 is a reply to message #9508] Mon, 28 May 2007 13:08 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
What i want to do is to open a new TopWindow which is placed in relation to my mainWindow.

e.g. my mainWindow is placed like this:

SetRect(300, 300, 500, 500);

Then i want to get the position of my mainWindow and place my childWindow e.g. like shown above.

I tried to get the info from the manual etc. but didn't get it right now.

Michael
Re: How to handle child windows [message #9724 is a reply to message #9712] Mon, 28 May 2007 14:12 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This should work, however, TopWindows are automatically centered.

Call NoCenter for the TopWindow being opened.

If that still does not work, please zip testcase and post here.
Previous Topic: How to delete all widgets on a TopWindow?
Next Topic: How to call class1 member after closing class2
Goto Forum:
  


Current Time: Fri Apr 19 11:55:03 CEST 2024

Total time taken to generate the page: 0.05470 seconds