Jump to content

DoubleClick on TitleButton


likemike

Recommended Posts

Hello!

I often use titlebuttons on forms.
But I've discovered, that you can use a doubleclick instead of a simple click. In that case the UnimFormTitleButtonClick event fires twice.
For ex.: if the UnimFormTitleButtonClick event is used to add a record in a database, with a doubleckick there are 2 records written.
Any idea how to prevent this from happening?

Regards

Mike

Link to comment
Share on other sites

It seems to be a general problem with OnClick-events. So my solution is:
 

USES DateUtils;

VAR LastClicked : TDateTime;

 :

PROCEDURE TFProjektInfo.UnimFormTitleButtonClick(Sender : TUnimTitleButton);
BEGIN
    IF MilliSecondsBetween(Now, LastClicked)<500 THEN Exit;
    LastClicked:=Now;
    // your code
END;

 

Link to comment
Share on other sites

×
×
  • Create New...