Solved

Resize Property Page/Sheet in Wizard mode

Posted on 1998-12-03
1
662 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now