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

x
?
Solved

Detecting which property sheet tag was selected?

Posted on 1998-07-09
6
Medium Priority
?
187 Views
Last Modified: 2013-11-19
How can I detect which page of a property sheet, if a user clicks on the tab of a page.

Example:
The user from the menu invokes a property sheet dlg.
Page 1 is on top, however, the user click on the tab of Page 3 and then selects OK/CANCEL.

How can find out that the last page the user was on before clicking OK/CANCEL was Page 3?

My code is something like this:
OnMenuSelection()
{
 ShowPage( of Poperty Sheet, Page No 1);
 if (User choose OK)
   Assign variables for Last Page User was on;
 else Do nothing;
}
- Thanks for your help
Gary.

0
Comment
Question by:papag
6 Comments
 
LVL 1

Expert Comment

by:Andy_Keys
ID: 1318956
GetActivePage()?
0
 

Author Comment

by:papag
ID: 1318957
GetActivePage()from where?
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1318958
To Initialize your CPropertySheet dialog, you are creating your own class derived form the sheet

OnMenuSelection( )
{
   CPropSheetOverride dlgPropSheet( "Your Title", this );

   if( dlgPropSheet.DoModal( ) != IDCANCEL )
   {
      iActivePage = dlgPropSheet.GetActiveIndex( );

      switch( iActivePage )
      {
      case 0:
         ... Assign page 0 stuff...
         break;
      case 1:
         ... etc...
      }
   }
}


0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:Andy_Keys
ID: 1318959
if "of Poperty Sheet" in the fn ShowPage( of Poperty Sheet, Page No 1); is a ptr to a propsheet then its
PtrPropSheet->GetActivePage() or if its an index you want then
PtrPropSheet->GetPageIndex( PtrPropSheet->GetActivePage() )
0
 

Author Comment

by:papag
ID: 1318960
I still need help this is driving me crazzzzzzzzzzzy!!!!!!!!

I have 4 pages on a property sheet, if the user choose am item from the menu the dialog opens with that page. Here thing work fine if the user stays on that page.  However, the user should go to another page and them quit. The result will be for the page the user was first exposed to.

How can I get the result of the last page the user was on before he quits?  How can I determine which was the last page the user was on?

Here is a sample of my code:
OnMenuItem1()
{      
   SelectPage(1);
}

OnMenuItem2()
{      
   SelectPage(2);
}
OnMenuItem3()
{      
   SelectPage(3);
}

//From user selection do the following
SelectPage(int nPage)
{
   CPropSheet propSheet( "Setting test parameters...",0,nPage);
   propSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;
   if ( propSheet.DoModal() == IDOK )
   {
      int iActivePage = propSheet.GetActiveIndex();
                  
      switch( iActivePage)
      {
      case 1:
      //Get the user selections from page 1
       szName = propSheet.m_Page1.m_userName;
         ..........
       break;
      case 2:
         //Get the user selections from page 2
       szName = propSheet.m_Page2.m_userName;
         ..........
       break;
      case 3
         //Get the user selections from page 3
       szName = propSheet.m_Page3.m_userName;
         ..........
       break;             }
      }
      else
          return;
}

Help!!!!!! driving me crazzzzzzzzzzzzzzzy
- Gary
0
 
LVL 2

Accepted Solution

by:
warmcat earned 100 total points
ID: 1318961
1) Derive a CPropertySheetGary from CPropertySheet and use this instead of the regular CPropertySheet

2) Add a public m_userName member variable to CPropertySheetGary

3) Override CPropertyPage::OnSetActive() for each CPropertyPage derivation

4) Set each overriden CPropertyPage::OnSetActive() member function to copy this->m_userName to ((CPropertySheetGary *)GetSheet())->m_userName

5) use the CPropertySheetGary::m_userName if DoModal == IDOK

6) drink coffee :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

886 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