Solved

GUI: DIalog Stacking and Popping in MS C++

Posted on 2016-08-16
4
98 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to file 3 100
Eclipse IDE - Cannot copy/paste from console output 8 392
Question to Pivot table 1 75
Are the two lines the same? If not what is the difference? 2 31
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

752 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