Home » U++ Library support » TopWindow&PopUp, TrayIcon » Modal vs non-modal window
Re: Modal vs non-modal window [message #11958 is a reply to message #11950] |
Thu, 04 October 2007 13:08 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Hello and welcome!
I assume you've already decided against a seperate class for the window, so what I would do is something like this:
One<AWindow> wnd;
void OpenAWindow() {
if (!wnd) {
wnd = new AWindow();
CtrlLayout(*wnd, "A Window");
wnd->ok <<= THISBACK(AWindowOK);
wnd->WhenClose = wnd->cancel <<= THISBACK(AWindowClose);
//wnd->Open(this);
wnd->OpenMain();
}
else
wnd->TopMost(false, false);
}
void AWindowOK() {
if (wnd->Accept()) {
// Do Something with data
AWindowClose();
}
}
void AWindowClose() { wnd.Clear(); }
(all members of another class)
This allows the window to be displayed non-modally. By changing OpenMain to Open(this) you will get a child window (always above parent). It's possible that Mirek might come along and tell me I've got this wrong though
Also, if you didn't care about memory release after closing (if it's a small app I wouldn't bother), you could just add the line:AWindow &wnd = Single<AWindow>() to all the functions you need to access the window, and remove the member variable.
Hope that helps.
James
edit: Forgot AWindowClose
[Updated on: Thu, 04 October 2007 14:59] Report message to a moderator
|
|
|
|
|
Modal vs non-modal window
By: NeonN on Wed, 03 October 2007 20:13
|
|
|
Re: Modal vs non-modal window
By: mrjt on Thu, 04 October 2007 13:08
|
|
|
Re: Modal vs non-modal window
By: NeonN on Thu, 04 October 2007 18:59
|
|
|
Re: Modal vs non-modal window
By: NeonN on Thu, 04 October 2007 20:08
|
|
|
Re: Modal vs non-modal window
By: mrjt on Fri, 05 October 2007 12:09
|
|
|
Re: Modal vs non-modal window
By: NeonN on Fri, 05 October 2007 13:47
|
|
|
Re: Modal vs non-modal window
By: mrjt on Fri, 05 October 2007 14:47
|
|
|
Re: Modal vs non-modal window
By: mirek on Sat, 06 October 2007 18:07
|
|
|
Re: Modal vs non-modal window
By: NeonN on Sun, 07 October 2007 18:33
|
|
|
Re: Modal vs non-modal window
By: mirek on Sun, 07 October 2007 19:37
|
|
|
Re: Modal vs non-modal window
By: NeonN on Sun, 07 October 2007 20:32
|
|
|
Re: Modal vs non-modal window
By: mirek on Sun, 07 October 2007 23:46
|
|
|
Re: Modal vs non-modal window
By: NeonN on Mon, 08 October 2007 09:14
|
|
|
Re: Modal vs non-modal window
By: mirek on Mon, 08 October 2007 10:52
|
|
|
Re: Modal vs non-modal window
By: NeonN on Mon, 08 October 2007 14:58
|
|
|
Re: Modal vs non-modal window
By: mirek on Sat, 06 October 2007 17:59
|
|
|
Re: Modal vs non-modal window
By: exolon on Fri, 05 October 2007 11:55
|
Goto Forum:
Current Time: Mon May 06 12:07:57 CEST 2024
Total time taken to generate the page: 0.01971 seconds
|