Solved

GUI: DIalog Stacking and Popping in MS C++

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Is COM supported from Apache 1 74
Safe conversion? 4 75
Issues with C++ Class 19 106
Visual Studio hangs on running project 6 59
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

756 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