Hiding dialogs w/ inactive main window

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
FoxbatLNS
Knows some wx things
Knows some wx things
Posts: 38
Joined: Thu Jun 14, 2007 7:33 pm

Hiding dialogs w/ inactive main window

Post by FoxbatLNS » Fri Feb 06, 2009 2:19 am

If I minimize or try to interact with the dialogs/windows in my application while it's in the middle of a function (before it reaches the Show(false) for some dialog), it seems like only the internal variable value change is registered, but the dialog itself doesn't disappear, after which the only way to make it disappear is manually doing Show(true) followed by a Show(false). Is there any way to mend this problem other than a complicated series of OnActivates and semaphores?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Fri Feb 06, 2009 7:03 pm

By "in the middle of a function", do you mean you are performing some heavy computation that freezes the GUI?

FoxbatLNS
Knows some wx things
Knows some wx things
Posts: 38
Joined: Thu Jun 14, 2007 7:33 pm

Post by FoxbatLNS » Mon Feb 09, 2009 9:19 pm

Right, like if it's reading data from a series of files, back to back, before attempting to hide the dialog and then return from the function.

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Mon Feb 09, 2009 9:45 pm

Do this heavy computation into a separate thread.

FoxbatLNS
Knows some wx things
Knows some wx things
Posts: 38
Joined: Thu Jun 14, 2007 7:33 pm

Post by FoxbatLNS » Mon Feb 09, 2009 9:51 pm

The whole idea is that the user shouldn't be able to do anything until the function's finished. Also, the problem is that this dialog hide command fails if it's done while the window's inactive, so putting the loading in a separate thread wouldn't mend the problem, for the most part.

I was just wondering if there's a semi-elegant way to go about it, rather than implementing a generous amount of OnActivates and semaphores.

User avatar
Disch
Experienced Solver
Experienced Solver
Posts: 99
Joined: Wed Oct 17, 2007 2:01 am

Post by Disch » Mon Feb 09, 2009 10:12 pm

Can you just call Update() after hiding the window? This supposedly would force redrawing of the window immediately (and would thus hide it immediately). Not sure if that would work though -- but it's worth a try.

FoxbatLNS
Knows some wx things
Knows some wx things
Posts: 38
Joined: Thu Jun 14, 2007 7:33 pm

Post by FoxbatLNS » Tue Feb 10, 2009 12:25 am

Nah, Update() didn't fix it, unfortunately. Like I said, I could have it call Show(true) + Show(false) for every dialog necessary when the main window reactivates, but that seems like an awfully hackish method.

Post Reply