Re: InteractiveChange and ProgrammaticChange Oddness

Author: Gene Wirchenko

Posted: 2016-06-15 at 12:31:48

At 07:45 2016-06-15, Ken Dibble <krdibble@stny.rr.com wrote:

[snip]

>Second Issue

>

>The code in the InteractiveChange() and ProgrammaticChange() methods

>of this textbox was originally identical.

>

>In order to add an error handler that displays a message, resets the

>values to empty dates, and does not crash the program, I added:

>

>IF TYPE("THIS.Value") <> "D" OR TYPE("THIS.OldValue") <> "D"

> *Issue some message

> THIS.Value = {}

> THIS.OldValue = {}

>ENDIF

>

>to the InteractiveChange() method before it gets to the property

>value-comparison line.

>

>Then I inserted

>

>THIS.Value = "Foobar"

>

>Above that block to test my change and ran the program.

>

>I began typing into the textbox. I immediately got Error 107 from

>the **ProgrammaticChange()** method.

>

>Yes, I had only made the change in the InteractiveChange() method.

>But I expected that method to generate the error message. Instead,

>somehow, when I started typing, InteractiveChange() ran to the point

>where I set the control's Value to a string, executed that line, and

>then, instead of generating the error message, execution somehow jumped to the

^^^^^^^

The ProgrammaticChange event "[O]ccurs when the value of a

control is changed in code." You just changed the value of the

control, so the event fired.

>ProgrammaticChange() method, where Error 107 occurred on:

>

>IF THIS.Value <> THIS.OldValue

>

>????

>

>I don't believe that InteractiveChange() is supposed to call

>ProgrammaticChange() or vice-versa. That's why there are two separate methods.

No, there are two separate *events*, because they fire for

different reasons. The docs for ProgrammaticChange Event start with

"Occurs when the value of a control is changed in code."

>I have often said that the VFP order of events does not always

>proceed as advertised, and I guess here is proof.

Not in this case.

>Any thoughts?

>

>Thanks and I hope you are amused.

Almost always.

Sincerely,

Gene Wirchenko

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2016 Gene Wirchenko