Re: Modal property ***.



Subclass CProperty*** and add your handlers. See the other reply for details.

One think I like to do is compute a checksum based on the values in the controls. So if
you simply respond to EN_CHANGE or BN_CLICKED notifications to set the "changed" flag, and
someone clicks a button, then unclicks, they have made no change, but the simplistic
solution thinks they have. Instead, I iterate through the controls. If it is a check box
or radio button, I add its value into the checksum (you need something like CRC32 or
something else other than a simple add-the-values-and-take-the-result because you don't
want unchecking one button and checking another to produce the same result. Similarly, I
checksum every character of an edit control. This means that if the original string was
ABC, you place the cursor at the end and type <backspace>C, the result is no net change.
The BN_CLICKED and EN_CHANGE notifications trigger the checksum. I usually display a
"changed" flag, so if the user resets the values, the "changed" flag would disappear. So
if the checksum after a change equals the original checksum, you just call
SetModified(FALSE).
joe



On Thu, 31 May 2007 21:24:58 GMT, "TonyG" <TonyG@xxxxxxxx> wrote:

My application has a modal property ***. Normally if the operator presses
"Cancel" the logic throws away the data changes and the *** closes.

Instead this is what I want to happen:
I check if any data changes were made. If changes were made, I pop up an
OK/Cancel message box asking the question: "Data has been modified. Press OK
to discard data modifications." So if the operator clicks OK, I throw away
the data changes and the property *** closes.

But if the operator clicks Cancel, I want to allow the property *** to
continue living. In other words... I want to abort the fact that the
operator clicked Cancel on the property ***.

I can't get this to work.

The OnCancel handler in the property pages allows me a way to ask my
questions, but there is no way to abort closure of the property ***.

IS THERE SOME WAY I CAN DO THIS?

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.