Mattias Gaertner ha scritto:
On Sat, 06 May 2006 13:26:44 +0200
Giuliano Colla <[EMAIL PROTECTED]> wrote:

  
Re-checking the patch I sent yesterday for Qt interface TMemo, I saw 
that I'm not sending an OnChange Event when the TMemo is 
programmatically changed. That is OnChange is generated only on user 
input on the memo.

The correction is trivial, just a few lines of code, but the 
philosophical question arises. Maybe it's already been discussed and 
settled since a long time, but I'm a newcomer.

The OnChange event exists only in controls which may be subject to user 
input, such as TEdit, TMemo, TComboBox TTrackBar and such.

For some of them it's reasonable to think that the same action which 
must be taken when the user changes something should also be taken when 
the program changes it (such as TTrackBar): this saves code.

For others, as TMemo, TEdit, and perhaps TComboBox, generating the 
OnChange event when the change comes from the program is IMHO more a 
nuisance than a feature. In my experience I've always been forced to add 
code in order to tell apart user input from changes coming from the 
program. Otherwise unwanted effects and/or unwanted circles are generated.
    

Me2.

 
  
So the philosophical question: is it right to follow Delphi logic for 
TEdit and TMemo OnChange, or it would be more reasonable to "improve" 
the matter, and generate OnChange only on user action?
    

IMHO we need both.
For Delphi compatibility we should follow the VCL behaviour here.
Maybe a Delphian can test and tell us.


  
In my working copy of Qt TMemo implementation I've added a conditional $IFDEF  DelphiOnChange. If defined it provides Delphi behavior, if not, OnChange is generated only for user actions. I've done that in order to test adequately both conditions, but, if approved, it could become a system wide conditional.
As an alternative we might provide, in addition to OnChange, a new event: OnUserChange (or whatever one decides to call it). That way OnChange would provide Delphi behavior, OnUserChange would be triggered only by user actions.

Waiting for suggestion before submitting next patch.

Thanks

Giuliano
_________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to