Solved

Detecting which property sheet tag was selected?

Posted on 1998-07-09
6
180 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 88
Named range not carried over 10 57
format the code in java 6 72
fizzArray  challenge 1 47
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

17 Experts available now in Live!

Get 1:1 Help Now