Solved

Detecting which property sheet tag was selected?

Posted on 1998-07-09
6
184 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
[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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 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