[Lazarus] infinite loop due no OnChange event firing

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Oct 13 11:26:29 CEST 2008


On Mon, Oct 13, 2008 at 11:05 AM, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
> Small correction: I don't think it is 'normal', but I do think one
> never should rely on this behaviour :-)

My apologies... :-)


> At the very least, all widget sets should react in the same manner:
> if the TEdit.OnChange event is not fired in GTK 1, it should not fire
> in Windows or GTK 2 or Mac either.
>
> And the latter is demonstratably not the case now; So this should
> definitely be fixed.

Agreed!

What is weird is that for the same of being complete, I created three
test applications. One TEdit and one TButton.  The edit has the text
'Hello' set at design time.  The Button's OnClick will assign the
value 'Hello' to TEdit.  Edit1.OnChange simply does a writeln to the
console to show it has fired.  Button1.OnClick does a writeln() before
and after the call to Edit1.  This application was created for fpGUI,
LCL-GTK1 and LCL-GTK2.  I can't reproduce the error we experienced in
tiOPF+LCL applications. Edit1.OnChange doesn't seem to fire now... :-(
 But it does in tiOPF+LCL apps. :-/


----------- example ----------------
procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.OnChange := @EditChanged;
end;

procedure TForm1.EditChanged(Sender: TObject);
begin
  writeln('edit changed');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  writeln('>> button clicked');
  Edit1.Text := 'Hello1';
  writeln('<< button clicked');
end;

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


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the Lazarus mailing list