Board index » delphi » TMouseDown

TMouseDown

I think that the help system of Delphi2.0 is not impressive much. I
don' t know what Borland intend to do, but this is not quiet fair for
their customers.

Can somebody tell me how I can write a conditioned statement to check
if the users press which mouse button? I have tried;

If TMouseDown = mbRight Then PopupMenu1.Popup;

and Delphi tells me that the '=' should be something like '('. Strange
enough that I haven't found any solution to this trouble. No example
even on the help page of TMouseDown. I wonder much what I have paid
for.

Saran Maitreiwech.

 

Re:TMouseDown


Quote

> If TMouseDown = mbRight Then PopupMenu1.Popup;

> and Delphi tells me that the '=' should be something like '('. Strange
> enough that I haven't found any solution to this trouble. No example
> even on the help page of TMouseDown. I wonder much what I have paid
> for.

What is TMouseDown? A type? In that case I can understand the error
message. Test a variable instead.

--
Bent Tranberg, Agder College, Grimstad
Grooseveien 36, 4890 Grimstad, Norway
e-mail: Bent.Tranb...@hia.no

Re:TMouseDown


In article <4mopsu$...@senior.nectec.or.th>, Saran Maitreiwech
<vir...@mozart.inet.co.th> writes

Quote
>I think that the help system of Delphi2.0 is not impressive much. I
>don' t know what Borland intend to do, but this is not quiet fair for
>their customers.

>Can somebody tell me how I can write a conditioned statement to check
>if the users press which mouse button? I have tried;

>If TMouseDown = mbRight Then PopupMenu1.Popup;

>and Delphi tells me that the '=' should be something like '('. Strange
>enough that I haven't found any solution to this trouble. No example
>even on the help page of TMouseDown. I wonder much what I have paid
>for.

The OnMouseDown event for a component has a Button parameter of type
TMouseButton. You can check for a right mouse button click by including
code such as this in the OnMouseDown event handler;

If Button = [mbRight] then
  {Do something here};

AFAIK Delphi does not have a TMouseDown type defined in its standard
libraries. If you have defined your own then the compiler will be
looking for a field belonging to that type in your If statement - hence
the missing '('.

You've paid for a very good product, but even the best car does not
survive when driven into a brick wall at speed :)
--
Barney Tyrwhitt-Drake

Re:TMouseDown


Quote
>You can check for a right mouse button click by including
>code such as this in the OnMouseDown event handler;

>If Button = [mbRight] then
>  {Do something here};

        I'd try

If Button = mbRight then

instead. (Hint: Button is declared as TMouseButton, not set of TMouseButton.)

Quote
>You've paid for a very good product, but even the best car does not
>survive when driven into a brick wall at speed :)

        Uh-huh.

--
David Ullrich
Don't you guys find it tedious typing the same thing
after your signature each time you post something?
I know I do, but when in Rome...

Re:TMouseDown


Quote
David Ullrich <ullr...@math.okstate.edu> wrote:
>>You can check for a right mouse button click by including
>>code such as this in the OnMouseDown event handler;

>>If Button = [mbRight] then
>>  {Do something here};
>    I'd try
>If Button = mbRight then
>instead. (Hint: Button is declared as TMouseButton, not set of TMouseButton.)

I think a ButtonState set like the shift-state set would have been a
handy extra parameter, so you don't have to build your own using
mouseup & mousedown events, if interested in button chords.

Quote
>>You've paid for a very good product, but even the best car does not
>>survive when driven into a brick wall at speed :)

True, but in a certain light this wall looks like a tunnel entrance,
right next to the (real) shift-state tunnel.

Regards,
Bengt Richter

Other Threads