Board index » delphi » Right Button doesn't give OnMouseUp event for TListView

Right Button doesn't give OnMouseUp event for TListView

Hi everyone!!

Consider this simple program description:

Quote
> Create a form with a TListView
> Add an item
> Handle the OnMouseUp event

Now, if I press and release the _right_ mouse button on the item, I
don't get the OnMouseUp handler called??!!

However, if I double-click the right button on the item, it seems to
work??!!

If I try on the ListView (not over the item), it works just fine.
Similarly, if I try with the left mouse button, it works just fine both
over and besides the item.

To me it seems like a bug, and if it is: does anyone have a suggestion
of how to circumvent this bug?!

Here is the my scenario, if anyone should have an idea of how to avoid
this peculiar behavior:

I use the OnMouseDown to detect OLE drags, so first at
button-release-time is it possible to determine whether the right mouse
button caused a drag or a popupmenu. Well, that's basically it!!

Hope you can help,

Thomas Hjort

 

Re:Right Button doesn't give OnMouseUp event for TListView


Mysterious... I don't have any solutions, but I did come up with some
strange behavour, FYI:

when *I* push the left or right mousebutton and hold it down, both a down
and up event are triggerd, when I release the mousebutton again, I get
another 'up'. Middle button (mousewheel) works as expected. When pushing a
mousebutton over an item, I get 'Down' and 'Up' as expected.
Here's my code:
Create new app, put a TListview and a TMemo on form1 and add following
event handlers.

procedure TForm1.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  memo1.lines.add ('Up');
end;

procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  memo1.lines.add ('Down');
end;

Using D4.03

So, if you find out anything please let me know

Quote
Thomas Hjort wrote:
> Hi everyone!!

> Consider this simple program description:

> > Create a form with a TListView
> > Add an item
> > Handle the OnMouseUp event

> Now, if I press and release the _right_ mouse button on the item, I
> don't get the OnMouseUp handler called??!!

> However, if I double-click the right button on the item, it seems to
> work??!!

> If I try on the ListView (not over the item), it works just fine.
> Similarly, if I try with the left mouse button, it works just fine both
> over and besides the item.

> To me it seems like a bug, and if it is: does anyone have a suggestion
> of how to circumvent this bug?!

> Here is the my scenario, if anyone should have an idea of how to avoid
> this peculiar behavior:

> I use the OnMouseDown to detect OLE drags, so first at
> button-release-time is it possible to determine whether the right mouse
> button caused a drag or a popupmenu. Well, that's basically it!!

> Hope you can help,

> Thomas Hjort

--
========================================
Berend Veldkamp
Visit our web site: http://www.geodan.nl
========================================

Re:Right Button doesn't give OnMouseUp event for TListView


Hi Thomas,

I have entered this as bug number 74120.  I tried this as a workaround, but
I don't think it will do the trick.  Oh Well.

procedure TForm1.ListView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  If Button = mbRight then ListView1MouseUp(Sender, Button, Shift, X, Y);
end;

--
R/S Aaron Rhodes
Delphi Technical Support

Quote

> > Create a form with a TListView
> > Add an item
> > Handle the OnMouseUp event

> Now, if I press and release the _right_ mouse button on the item, I
> don't get the OnMouseUp handler called??!!

> However, if I double-click the right button on the item, it seems to
> work??!!

> If I try on the ListView (not over the item), it works just fine.
> Similarly, if I try with the left mouse button, it works just fine both
> over and besides the item.

> To me it seems like a bug, and if it is: does anyone have a suggestion
> of how to circumvent this bug?!

> Here is the my scenario, if anyone should have an idea of how to avoid
> this peculiar behavior:

> I use the OnMouseDown to detect OLE drags, so first at
> button-release-time is it possible to determine whether the right mouse
> button caused a drag or a popupmenu. Well, that's basically it!!

> Hope you can help,

> Thomas Hjort

Re:Right Button doesn't give OnMouseUp event for TListView


Quote
> Consider this simple program description:

> > Create a form with a TListView
> > Add an item
> > Handle the OnMouseUp event

> Now, if I press and release the _right_ mouse button on the item, I
> don't get the OnMouseUp handler called??!!

Use the OnContextPopup event handler. It is new in D5 and the right mouse
handling has changed somewhat on some controls.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:Right Button doesn't give OnMouseUp event for TListView


Darnit!  Okay, so it is as designed?  So noted.

--
R/S Aaron Rhodes
Delphi Technical Support

Re:Right Button doesn't give OnMouseUp event for TListView


In article <7vt5jl$c...@forums.borland.com>, Aaron Rhodes [Borland]
wrote:

Quote
> Darnit!  Okay, so it is as designed?  So noted.

I'm not sure whether it is working as intended, since the mouse
events and OnContextPopup should not be mutually exclusive.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:Right Button doesn't give OnMouseUp event for TListView


Well I put a note about it in the bug description.

--
R/S Aaron Rhodes
Delphi Technical Support

Quote
> > Darnit!  Okay, so it is as designed?  So noted.

> I'm not sure whether it is working as intended, since the mouse
> events and OnContextPopup should not be mutually exclusive.

Other Threads