Hi,

In tiOPF with LCL widgetset we hit a little snag. We react to the
OnChange event of a TEdit. In GTK1 we have no issues. In GTK2 we get a
core dump as soon as the text has changed (first key being pressed).
Here is a discussion about the issue between Michael and myself.
Michael thinks it's normal, I think it's a bug in LCL.

-------------------------[ forward reply from myself ]------------------
Michael van Canneyt wrote:
> We looked into this, and it is the mediator design flaw which I told
> you about: you rely on the fact that setting the text of an edit to
> the same text will not trigger the OnChange event. Something which I
> thought you should not rely on.

I still believe this is a bug in the GTK2 (or LCL-GTK2 widgetset).
OnChange tells me the value has changed. Setting the Text to the same
Text value doesn't change the value, so there is no need to fire the
OnChange event.

It is quite normal to have the following in a "setter" method where
FValue is the internal storage field and AValue is the new parameter
value passed in.

if FValue = AValue then
  Exit;
{ if we got here then something has really changed...}
FValue := AValue.
DoOnChange;    // or whatever else...

---------------------------------[ end ]-----------------------

Like I explained above... Surely there is no need to fire a OnChange
event if the TEdit.Text is set to the exact same Value.

eg:

 Edit1.Text currently has the value:  'Hello'.

No I do the following...

  Edit1.Text := 'Hello';

I'm assigning the same value to Edit1.Text again... nothing changed,
so why must OnChange file?  See my example code which is pretty normal
code for any setter method and even auto generated by Lazarus IDE.


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to