Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Displaying Property Pages as individual Dialogs

Posted on 1998-06-11
6
Medium Priority
?
188 Views
Last Modified: 2013-11-20
I'm creating an application in which I would like to display certain pages as both individual dialog boxes, and as
the tabs of a property sheet. The user would be able to choose if they wanted them all together or not.

So, I created the pages as descendants of the CPropertyPage class... which is itself a descendant of CDialog.
But when I try to display the pages individually by calling DoModal(), it just crashes and won't display anything.

Any tips would be greatly appreciated.
--Anthony (ajnicholson@lucent.com)
0
Comment
Question by:nicholso
  • 3
  • 2
6 Comments
 

Author Comment

by:nicholso
ID: 1317860
Adjusted points to 200
0
 
LVL 1

Expert Comment

by:motigust
ID: 1317861
You did the right thing.
It should work, maybe somthing else is wrong.

Were does it crushes? Which function?
Can you give an example of that point in your code?


0
 

Author Comment

by:nicholso
ID: 1317862
i tried it with a different dialog box and it works now. I don't know what the problem was.
Thanks for your time!

Anthony
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Accepted Solution

by:
shaig earned 800 total points
ID: 1317863
Acording to the MFC documentation CPropertyPage inherits from CWnd rather then from CDialog.
What i do is create ( DoModal() ) a property sheet with a single page instead of playing with dialog boxes, infact i can't remember when was the last time i used a dialig box. your thinking is right, CPropertyPage gives you modularity.

does this solution suit you?
0
 

Author Comment

by:nicholso
ID: 1317864
shaig:
 Your solution does work, but it looks silly because you have a window with a titlebar, then it has only 1 tab with the same title on it... is there any way to get the property
sheet you have created with only one page to not have a tab at the top?

Also, can you center the OK,Cancel,Apply buttons?
thanks
anthony
0
 
LVL 3

Expert Comment

by:shaig
ID: 1317865
I'll start with the buttons:
You can do whatever you want with the buttons ( including hiding them ) if you do this:

//sample code from the sheet's OnInitDialog
CWnd *pWnd = GetDlgItem( IDOK );
pWnd->MoveWindow( centerCordinates );
or:
pWnd->ShowWindow( SW_HIDE );

do the same with cancel, apply and help.
regarding the tab:  i don't have a clean solution. you can move the tab control up so the sheet's title bar will hide the sub-title, this can be done this way:
CTabCtrl *pTab = GetTabCtrl();
pTab->MoveWindow( reduce the y, cy condinates )

hope i've helped.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Loops Section Overview

926 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