Property Sheets :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
Hi.

I will design and implement a property sheet for a small program I am working on. I have access to Jeff Prosise's example from his book. However, he does not explain the process of linking the property sheet and property pages to their cooresponding dialog boxes.

For example, let say I would like a property sheet with two property pages. I am not sure how to go about linking them to the dialog boxs.
The following questions apply to the sample dialog box I mentioned above (property sheet w/ 2 property pages).

1) How many dialog boxes do I have to create using Dialog Editor? Two or three? Is the property sheet alone considered a dialog box and I have to *create an empty dialog box to serve as the property sheet*?

2) For each dialog box, how do I create them such that they are the same sizes? Do I just eyeball their sizes or their sizes will be based on the size of the property sheet (given you have to create a dialog box for the property sheet).

3) Is it possible to use ClassWizard to implement the classes for the property sheet and property pages?

Thanks,
Kuphryn
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Property sheets run off of the tab control.
CPropertySheet Sheet();
Sheet.Create(...);
Sheet.AddPage(...);

Put the control in your parent dialog box.

Create additional dialogs for each "sheet".

When you define a class for each sheet, select them as property pages rather than a dialog. The coding of everything else is the same

Is very simple

From MSDN


<< The CPropertySheet class encapsulates a Windows property sheet, otherwise known as a tabbed dialog box. A property sheet consists of a CPropertySheet object and one or more CPropertyPage objects. >>

 

kuphryn

Senior member
Jan 7, 2001
400
0
0
Thanks.

I got the property sheet to work with two property pages. I used the default method (same as yours) to create the property sheet. Now I am trying to figure out how to update the data in doc after the user clicks Apply in the property sheet. Jeff Prosise derived a completely separate property sheet, thus I can seen what is going on with is code. However, with MFC default CPropertySheet, I am not sure how to copy data from the property pages to data in doc. In the code Prosise creates, the property sheet sends a message to main, which redirects the message to view where the data are copied. Prosise uses the ELLPROP data structure.

Do I have to create something similar to what Prosise shows or is there a default way to copy data after the user pushes Apply?

Kuphryn
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
When I use Dialogs( / Property pages) I use the SetWindowText & Get Window Text instead of the Update function.
The items are controls. Habit that I started with and I feel that this allows me better flexibility on presentation and such.
What you would can do with a dialog, is the same as you do with a property page. The CPropertyPage is derived from a CDialog.

When I need to update the page, either a message handler from within a page is triggered by a user action, an external method sends a WM_USER message to the page for me to handle or I have an public function that some-one can get to.

All my Pages are derived from a special PropertyPage derived page that has this public interface trigger for use.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Property Sheets are a peice of cake

On cosmetic tidbit.
Try to keep the controls on the pages lined up as closely as possible.
On slow systems, when the pages are repainted from one tab to another, flickering may become visible.