Sign in to follow this  
Followers 0
Dicemaster Slayer

Parents, children, and modal confusion

4 posts in this topic

So, writing a game, has one big window that holds everything. Mostly. During a player's turn in the game, they have the choice of 4 actions, all of which have their own windows secondary to the main one.

In addition, I have a sort of custom error dialog box that pops up when the user does something I don't want them to (invalid filename entry, trying to load a file that isn't a saved game, etc.), but is also used for help boxes and general information boxes. This error box can be called by the main window or by the secondary windows.

What I am trying to accomplish is if the player starts an action (which creates a child window for that action), then they cannot use the main window until that action has finished (the secondary window is GUIDelete'd). Also, if the error box pops up, then you can't use the main window (or any secondary window, if present) until you close the error box.

I've attempted this thus far by making the secondary windows childs of the main window, and setting @SW_DISABLE on the main window while the secondary is present. When the secondary leaves, I @SW_ENABLE the main window. This is simple enough (and mostly works), but it caused some flickering of the main window when the secondary was opened or closed. Same with the error box, if the program were to call it then it would disable the current window (which is easy to determine, given the program flow), show the box, and then reenable the window when the box leaves. In this way, a secondary window could call the error box, where the main window would already be disabled, and the error box would disable the secondary.

So, tl;dr, I need to be able to have modal windows, also with multiple modal windows up at the same time.

I've tossed the idea around in my head of using modal GUIs instead of @SW_DISABLE or ENABLE, simply because (so I hope) it will eliminate or at least diminish the flickering of the main window when the secondary or error windows are created and deleted.

My thought is: secondary windows will be declared as modal childs of the main window. The error box will also be declared as a modal child of the main window, so that if a secondary window calls the error box, it will take precedence over the others.

And my question is: What do I use to make these windows modal, as in you can't use the parent until the child is closed? $DS_MODALFRAME? $WS_EX_DLGMODALFRAME? Something completely different? Or should I just stick with @SW_DISABLEing the windows?


Share this post


Link to post
Share on other sites



Big Question, So I Will Bump It..Many Get Some Experts Over Here

Hint Hint: Valik

:D

Share this post


Link to post
Share on other sites

yeah sorry about the textwall

basically modal windows, how to?


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0