Solved

Resize Property Page/Sheet in Wizard mode

Posted on 1998-12-03
1
683 Views
Last Modified: 2013-11-20
I have a wizard made up of property pages on a property sheet.

Multiple pages with Next/Back etc.

I want the last page (only) to automatically size it self to cover pretty much the whole screen.  Can get screen size using GetSystemMetrics.  Any ideas how to resize the last property page of a wiz to the screen on the fly, n.b. I need to resize back to original size if the user presses back button.

Please remember I've set Wizard mode if this makes a difference.

Thanks
0
Comment
Question by:Answers2000
[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
1 Comment
 
LVL 1

Accepted Solution

by:
hbuehler earned 20 total points
ID: 1325717
Hi!

1) changing size of the property sheet (it doesn't matter whether it is a wizard or not):

You can achive this by calling SetWindowPlacement() or an equal function on the sheet. Afterwards, you must even resize your page by SetWindowPlacement().

However, if you do so, the controls ("next","finish" etc.) won't automatically change their location.
You can add a WM_SIZE message handler to the _sheet_ and reposition these controls by hand (I suggest you even overwrite OnInitDialog() (this exists :) to initially read in their original positions.

You need to reposition the controls with the following codes:

ID_WIZNEXT,
ID_WIZFINISH,
ID_WIZBACK,
IDOK,
IDCANCEL,
ID_WIZNEXT,
ID_APPLY_NOW,
IDHELP,
AFX_IDC_TAB_CONTROL,
ID_WIZFINISH+1,      /* the bevel line*/

You can get a CWnd to the controls by using GetDlgItem()
(assuming you have __max control ids in an array m_ids[__max+1]
and some WINDOWPLACEMENT structures in m_wpl[__max+1]):

for(int i=0;i=<__max;++i)
{
  if(CWnd *pCtrl = CPropertySheet::GetDlgItem(m_ids[i]))
    pCtrl->GetWindowPlacement(m_wpl[i]);
}

2) Changing your sheet's size:

You can overwrite the page's OnSetActive().

use the following (pseudo-)code:

 BigPage::OnSetActive()
 {
   m_pSheet->GetWindowPlacement(&wpl_sheet_backup);
   GetWindowPlacement(&wpl_page_backup);

   m_pSheet->SetWindowPlacement(&wpl_sheet_big);
   // m_pSheet is a pointer to your sheet; you could use
   // GetParent() if you don't like to hold one.
   // Since you catch WM_SIZE to reposition the controls,
   // they'll be put to the right position.

   SetWindowPlacement(&wpl_page_big);
   // set BigPages' size
 
   ...
 }

To resize the sheet if going back, catch the virtual function
OnWizardBack():

 BigPage::OnWizardBack()
 {
   SetWindowPlacement(&wpl_backup_page);
   m_pSheet->SetWindowPlacement(&wpl_backup_sheet);
   ...
 }

That should work.

NOTE: If you may want to make use of my code which gives you reizable sheets at all, have a look at http://www.codeguru.com (one of the finest MFC sites :) BUT - Unfortunately it hasn't been published yet (I sent it there yesterday) ... so maybe you have to wait some days :(

- Hans



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
Hibernate methods 2 87
bigDiff challenge 17 142
zeroFront challenge 7 136
Problem to event 3 123
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

734 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