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
Solved

GUI: DIalog Stacking and Popping in MS C++

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

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 33

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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

809 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