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

x
?
Solved

Data update on property page

Posted on 2002-07-15
3
Medium Priority
?
268 Views
Last Modified: 2013-11-20
I got a bunch of property pages, and am creating more. I am looking for a way to detect changes in the controls (mostly Edit, Check box and radio buttons) on the property pages. The way I want it to work is like this:

Associated with the controls, I have data members with current values. When the user makes the changes on the property page and switch to another page before doing UpdateData() or Apply(), I want some way to know that and give an alert.

I know I could write a function for each control to handle this, but that is a lot of repeated work. Ideally I want to have a common base class, say CMyPropertyPage, that handles this once for all, and a particular property page, say CMySpecificPage, will be derived from CMyPropertyPage.

The best would be it will compare the values on the page with the data members and alert any differences. Or it would also be fine if any actions by the user on the controls are detected, values change or not.

Thank you very much. I am new here with only 75 points. I thought the problems is worth more than that.

GRST
0
Comment
Question by:GRST
  • 2
3 Comments
 

Accepted Solution

by:
skibud2 earned 225 total points
ID: 7154803
Handle the OnCommand message for the property page.

BOOL CPropPage::OnCommand(WPARAM wParam, LPARAM lParam)
{
     if (HIWORD(wParam)==EN_CHANGE)
          AfxMessageBox("Something has changed");

     return CPropertyPage::OnCommand(wParam, lParam);
}
0
 

Expert Comment

by:skibud2
ID: 7155284
Did this work for you?
0
 

Author Comment

by:GRST
ID: 7157312
Hi skibud2,

Thanks for the response. I tried your method. It worked to certain extent, but is somewhat over sensitive and over simplified. It is triggered whenever the edit box is touched, even when the dialog (prop page) is initialized, during which it is simply loading the data members to the edit boxes. Another case is when the edit box is changed then changed back to the original before being saved to the data members. It is essentially not changed.

If there is no better way, I might just adapt your way to the program. But what I'm really looking for is a check such that:

- when the page is initialized, the associated data members, with initial values already, are loaded to the dialog and this should not trigger the check,

- when the page is becoming inactive, the function will check to see whether the data on the page become different from the associated data members.

I was thinking about modifying/overwriting those DDX_***()'s in DoDataExchange().

Do you, or anybody, have better ideas?

Thanks again. I appreciate it.

GRST
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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: 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…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

927 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