?
Solved

control chnages in a dialog MFC

Posted on 2010-01-11
5
Medium Priority
?
352 Views
Last Modified: 2013-11-20
Hiya

Suppose I have a dialog with numerous controls in it e.g. edit boxes, radio buttons, check boxes.

Is there a simple way for me to find out if the dialog is opened, controls modified e.g. values in edit boxes changed or radio button selections changed, and then closed. That is, is there a way to determine whether values or changed or not during the opening and closing of the dialog?

I could of course look at the OnChange message for each control in the dialog but if there are many controls this maybe difficult and time consuming. It also doesn't deal with the issue of changing a value and then re-setting it to its original before leaving the dialog i.e. no changes have been made.

Any ideas?

John
0
Comment
Question by:IssacJones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 750 total points
ID: 26281833
You would have to code something yourself.


Possibly have a struct (class) with the original settings - use the OnInitDialog to copy those values into the controls.
When the dialog is closed you can use UpdateData to find the current settings - now compare the initial setting when the current settings.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26281891
Another idea is to add a boolean (integer) variable that becomes true when the user changes any data. This variable becomes false when the changed values were saved/handled.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 26281958
@pgnatyuk - good idea to flag a change simply, but it fails on following requirement I think:

 >>It also doesn't deal with the issue of changing a value and then re-setting it to its original before leaving the dialog i.e. no changes have been made.
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 750 total points
ID: 26282266
As AndyAinscow says, it requires special programming... there is no quick/easy solution.
There is typically an area in the code, right before the DoModal() call,  that sets member variables from some external source (the registry, for instance).   Since all the pre-set values are listed together there, you can use that part of your code to help in creating your own IsDirty() function.  
0
 

Author Closing Comment

by:IssacJones
ID: 31675412
Thanks guys
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

801 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