WPTools

How can I avoid left-click effect when double-clicking on a TDBWPRichText?

J.A.
umhAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

quiqueCommented:
You'll have to use FIgnoreAllMouseEvents in the object and then a Timer to activate it again.

QUIQUE.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kretzschmarCommented:
hi,

you can do a construction like this

Var ClickPending : Boolean = False;

procedure TForm1.FormClick(Sender: TObject);
Var I : Integer;
begin
  ClickPending := True;
  I := GetTickCount;
  while GetTickCount - I < 100 do
    Application.ProcessMessages;
  If ClickPending then
  Begin
    //
    Label1.Caption := 'Click';
    ClickPending := False;
  end;
end;

procedure TForm1.FormDblClick(Sender: TObject);
begin
  ClickPending := False;
  Label2.Caption := 'DblClick';
end;

remark: it is a general problem and not specific for TDBWPRichText

the value of 100 i used here is just tried, but you can get the delay which windows wait before it fires a dblclick-message from windows self.

meikl
0
kretzschmarCommented:
hi again,

to get the system-doubleclicktime use the function GetDoubleClickTime like

Var ClickPending : Boolean;

procedure TForm1.FormClick(Sender: TObject);
Var I,J : Integer;
begin
  ClickPending := True;
  J := GetDoubleClickTime;
  I := GetTickCount;
  while GetTickCount - I < J do
    Application.ProcessMessages;
  If ClickPending then
  Begin
    //
    Label1.Caption := 'Click';
    ClickPending := False;
  end;
end;

procedure TForm1.FormDblClick(Sender: TObject);
begin
  ClickPending := False;
  Label2.Caption := 'DblClick';
end;

meikl
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

kretzschmarCommented:
appendix (correction),
Var I,J : Integer;
shoud be
Var I,J : DWord;
meikl
0
kretzschmarCommented:
hmm, i see, just accepted :-(
0
kretzschmarCommented:
hi quique

just for satisfy my Curiosity

where do i find FIgnoreAllMouseEvents ?
when do i set it ?
when do i start the timer ?
how do i determine the intervall ?

meikl

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.