Solved

GUI: DIalog Stacking and Popping in MS C++

Posted on 2016-08-16
4
58 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
  • 2
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
Comment Utility
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
Comment Utility
Yes, you are correct to point me away from Modals.   Still working on it...
0
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now