Solved

Detecting which property sheet tag was selected?

Posted on 1998-07-09
6
182 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 91
format the code in java 6 93
Doc'in system (example?) BA 7 110
scoreUp challenge 14 62
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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