Solved

Data update on property page

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
Expand to include initial dialog with two choices. 9 77
has77  challenge 9 83
tripleUp challenge 7 78
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: 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…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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