Solved

Detecting which property sheet tag was selected?

Posted on 1998-07-09
6
181 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 37
How to determine file rename from EventLog ? 2 43
maxBlock challenge 30 112
scoreUp challenge 14 57
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

14 Experts available now in Live!

Get 1:1 Help Now