Board index » delphi » Check if left mousebutton is clicked?

Check if left mousebutton is clicked?

Hi!

How do I check if the left mousebutton is pressed (not
WM_LMOUSEBUTTONDWON)??? I need a function that returns a value
(true/false)!

Tnx in advance!

leona...@dame.de

 

Re:Check if left mousebutton is clicked?


Quote
Rias Sherzad <christof.schm...@hamburg.isys.de> wrote:
>Hi!
>How do I check if the left mousebutton is pressed (not
>WM_LMOUSEBUTTONDWON)??? I need a function that returns a value
>(true/false)!
>Tnx in advance!
>leona...@dame.de

You can create a global boolean variable like MouseIsDown and set it
to FALSE in the form's OnShow. In OnMouseDown, set MouseIsDown to TRUE
and in OnMouseUp set MouseIsDown to FALSE.

Within remaining code use global boolean like a function:
  if(MouseIsDown)then blah,blah,blah...
  while(MouseIsDown)do
    begin
       blah,blah,blah,...
       Application.ProcessMessages;
    end;

Re:Check if left mousebutton is clicked?


Use:

function MouseLeftButtonIsDown: booelan;
begin
  result := (GetAsyncKeyState(VK_LBUTTON) and $1000);
end;

--
Rob Lans
E-mail: rob.l...@nob.nl

Rias Sherzad <christof.schm...@hamburg.isys.de> wrote in article
<31E7579D.6...@hamburg.isys.de>...

Quote
> Hi!

> How do I check if the left mousebutton is pressed (not
> WM_LMOUSEBUTTONDWON)??? I need a function that returns a value
> (true/false)!

> Tnx in advance!

> leona...@dame.de

Other Threads