Solved

Data update on property page

Posted on 2002-07-15
3
260 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 75 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 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