Solved

GUI: DIalog Stacking and Popping in MS C++

Posted on 2016-08-16
4
109 Views
Last Modified: 2016-08-29
Using MFC C++ in VS2015.    Want to create a GUI that is essentially 5 full-screen panels, and the user flips between them as needed.  Would like to have these panels all "up" and initialized, but just showing one "on top".   When the user clicks a button to go to another panel, would just like to pop that one on the top of the stack.

I'm thinking this might flip faster and look better than how it works now, which is 'close one panel, open another'.  Part of the current problem is that windows does this 'fancy' animation thing of making windows look like they 'grow' as they pop into place.  Normally that is cute, but in this case, looks weird. Any way to turn that off?

There are so many choices and hacks to try to get dialogs to do what you want, I was wondering if anyone had some basic guidance to steer me through the choices.  For example: can they all be modal?  or better if they are modeless?  should they all be a "child" of one master dialog  or does it matter?

And, I've tried a lot of things to try to "pop a dialog" to the top (like 'SwitchToThisWindow', and 'SetForegoundWindow', and 'BrindWindowToTop', etc) and they don't  really work, but perhaps that because I should make the dialogs modeless (they are modal now), or maybe its due to a certain parent-child tree that I should have.

Help?
0
Comment
Question by:tullhead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
sarabande earned 500 total points
ID: 41758599
modal dialogs can't do what you want.

you may look for mfc samples using CSpreadSheet. that is a "tab control" that can handle a non-modal dialog page for each tab.

if you don't like the tabs you alternatively could use CFormView for each page and CMainFram as the parent frame. doing so, you could use buttons on the pages or in the menu area of the frame to switch between pages.

note,  'SwitchToThisWindow', and 'SetForegoundWindow', and 'BrindWindowToTop', are low level functions which are not suitable for handling top level windows since there are too much automatisms which would spoil any premature win api call.

Sara
0
 

Author Comment

by:tullhead
ID: 41763760
Yes, you are correct to point me away from Modals.   Still working on it...
0
 
LVL 34

Expert Comment

by:sarabande
ID: 41771458
when you create a new MFC application you could choose between dialog-based, SDI and MDI.

SDI stands for single-document-interface what allows to have multiple 'views' for one model or document. i don't know whether that fits exactly to your needs you might give it a trial.

create a new SDI application and change the CView class generated to an CFormView. the CFormView uses a dialog form but is a non-modal dialog embedded into a frame with menus and minibuttons (like in visual studio). you could add more form views if you look into InitInstance function of your application class. and you could add menu entries and/or mini-buttons to switch between dialog forms. additionally you may add 'next' and 'previous' buttons to the forms.

Sara
0
 

Author Closing Comment

by:tullhead
ID: 41775304
Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question