[SOLVED] Strange behavior with double click in BitBtn lazarus / 31-LCL ---------------------------------------------------------------------- clauslack · 2010-03-01 19:10 Strange behavior with double click in BitBtn. I have a program for insert data with this cycle Click a BitBtn->DoubleClick Dbgrid->Click a BitBtn->DoubleClick Dbgrid, etc, etc But, some Newbie users, does a DoubleClick in BitBtn, and the BitBtn1Click procedure run twice and show an Access Violation. For avoid that I do it that. Code: [Select]procedure TForm1.FormCreate(Sender: TObject); begin    BitBtn1.caption:='1'; end; procedure TForm1.BitBtn1Click(Sender: TObject); var nro:integer; begin    BitBtn1.Enabled:=False;    nro:=StrToInt(BitBtn1.caption);    sleep(1000);    inc(nro);    BitBtn1.caption:=IntToStr(nro);    BitBtn1.Enabled:=True; end; But with double click in BitBtn the procedure still does run twice.(nro=2) How can I run the BitBtn1Click only one time, even when the user does a doble click in BitBtn? Tested with Lazarus 0.9.29 svn 23817 fpc 2.5.1 Delphi 5 show the same behavior. Any Idea? Thanks ---------------------------------------------------------------------- clauslack · 2010-03-12 11:45 I used a simple flag for run once the code (work fine for the example above), but in the main programa still  show A.V. But I found the problem. QueueAsyncCall http://wiki.lazarus.freepascal.org/Asynchronous_Calls Async call is only executed after the Button Click event has finished. So now works fine.