Solved

Data update on property page

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

19 Experts available now in Live!

Get 1:1 Help Now