Board index » delphi » Double click - left click

Double click - left click

I have a tray icon in which when I left-clicked
a pop-up will show, and when double-clicked,
a form will show. I'm having trouble with the
double-click since it also fires the left-click and
the pop-up shows together with the form.
It's really not neat.

Is there anyway to bypass the left-click when
double-clicked ? Such as delay showing the pop-up
and wait for the next click just to make sure it really
is just a left click.
I just don't know how to do it.

TIA

 

Re:Double click - left click


Quote
DECK <d...@backpacker.com> wrote in message news:3a81c318$1_1@dnews...
> I have a tray icon in which when I left-clicked
> a pop-up will show, and when double-clicked,
> a form will show. I'm having trouble with the
> double-click since it also fires the left-click and
> the pop-up shows together with the form.
> It's really not neat.

> Is there anyway to bypass the left-click when
> double-clicked ? Such as delay showing the pop-up
> and wait for the next click just to make sure it really
> is just a left click.
> I just don't know how to do it.

The 'left-click'  (OnClick) will always be fired
when you do double-click. Also it may confuse users,
why not assign Menu to the right click?
However you can use smth like this:

{Timer.Interval := 500, Timer1.Enabled := False}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  Label1.Caption := 'Single click';
end;

procedure TForm1.Panel1Click(Sender: TObject);
begin
  Timer1.Enabled := not Timer1.Enabled;
end;

procedure TForm1.Panel1DblClick(Sender: TObject);
begin
  Timer1.Enabled := False;
  Label2.Caption := 'Double click';
end;

it won`t be reliable as user can redefine the timing of the double click
by himself . I`m not quite sure but probably there are settings in the registry
for this, you can read them and setup timer interval accordingly.

Hope this help.

Regards,

Jack Sudarev.

Other Threads