Validating Changes in a Dialog
Posted
by Chris Olson
on March 6th, 2001
cChangeValidate is extremely easy to implement and use. It was written in a very basic form, and anyone should be able to incorporate it into their project with a minimum of difficulty. Note: cChangeValidate only stores the data for Combo Boxes, Edits, Buttons, and List Controls. If you wish to store data for say Static text or a specific class, just add another check in the cChangeValidate CALLBACK functions for your class and perform data storage and checking as necessary. Below is some sample code to actually run the class.
void Foo::Init()
{
// cChangeValidateClass is a member variable of whichever class
// wants to use it. It must be global in scope and not local
// otherwise you obviously would not be able to store the data
// for later use
cChangeValidateClass.CycleControls( GetSafeHwnd());
return;
}
void Foo::OnOK()
{
if( cChangeValidateClass.Compare())
{
//data has not been changed
OnCancel(); //Or whichever process you wish to perform
return;
}
//If data has been changed continue with processing
}

Comments
There are no comments yet. Be the first to comment!