Board index » delphi » Right Clicking TreeView and ListView

Right Clicking TreeView and ListView

I am experiencing the following strange behavior in Delphi 5:

When right clicking a Treeview the following events happens (in this
order):  OnMouseDown, OnContextPopup. The event OnMouseUp is NOT
generated (no matter if the Handled variable in the OnContextPopup is
set to true or false).

On the other hand, when right clicking a Listview the following events
hapens (in this order): OnContextPopup, OnMouseDown, OnContextPopup,
OnMouseUp.  In ther word, an extra OnContextPopup is generate before the
OnMouseDown. Again, that independs whether the Handled variable in the
OnContextPopup is set to true or false.

Am I doing something wrong?  Is that a bug? If so is there any
workaround?

Regards,
Ramiro

 

Re:Right Clicking TreeView and ListView


I am experiencing the following strange behavior in Delphi 5:

When right clicking a Treeview the following events happens (in this
order):  OnMouseDown, OnContextPopup. The event OnMouseUp is NOT
generated (no matter if the Handled variable in the OnContextPopup is
set to true or false).

On the other hand, when right clicking a Listview the following events
hapens (in this order): OnContextPopup, OnMouseDown, OnContextPopup,
OnMouseUp.  In ther word, an extra OnContextPopup is generate before the
OnMouseDown. Again, that independs whether the Handled variable in the
OnContextPopup is set to true or false.

Am I doing something wrong?  Is that a bug? If so is there any
workaround?

Regards,
Ramiro

Re:Right Clicking TreeView and ListView


Quote
Ramiro Guerreiro wrote:
> I am experiencing the following strange behavior in Delphi 5:

> When right clicking a Treeview the following events happens (in this
> order):  OnMouseDown, OnContextPopup. The event OnMouseUp is NOT
> generated (no matter if the Handled variable in the OnContextPopup is
> set to true or false).

If you read the M$ docs on a Treeview it is stated that the control will eat
the Right Mouse up message.

Jim

Re:Right Clicking TreeView and ListView


Jim,

In Delphi 2 , under the same Windows 95,  the TreeView control did NOT eat the
Right Mouse Up message.  I just upgraded to Delphi 5, I didn't upgrade
Windows.   It does not seem to be a Windows problem.

Do you have any idea why ListView is also behaving strangely?
"Right clicking a Listview the following events hapens (in this order):
OnContextPopup, OnMouseDown, OnContextPopup,
OnMouseUp.  In other words, an extra OnContextPopup is generated before the
OnMouseDown. Again, it does NOT depend whether the Handled variable in the
OnContextPopup is set to true or false".

Thanks for your help.
Ramiro

Quote
Jim Kueneman wrote:
> Ramiro Guerreiro wrote:

> > I am experiencing the following strange behavior in Delphi 5:

> > When right clicking a Treeview the following events happens (in this
> > order):  OnMouseDown, OnContextPopup. The event OnMouseUp is NOT
> > generated (no matter if the Handled variable in the OnContextPopup is
> > set to true or false).

> If you read the M$ docs on a Treeview it is stated that the control will eat
> the Right Mouse up message.

> Jim

Re:Right Clicking TreeView and ListView


Oops, that was for the listview:

WM_RBUTTONDOWN:
Processed the same way as the WM_LBUTTONDOWN message, except that the
control sends an NM_RCLICK notification message (instead of NM_CLICK) and an
LVN_BEGINRDRAG notification message (instead of LVN_BEGINDRAG). Note that
the control processes the corresponding WM_RBUTTONUP message, and does
not dispatch it. Applications thus cannot see this message, even by subclassing
the control.

It think you will have to look through the VCL code.  I think the treeview message
get "helped" in the main message loop since I have to double click the right
button to get a WM_RBUTTONUP message.

Good luck,
Jim

Quote
Ramiro Guerreiro wrote:
> Jim,

> In Delphi 2 , under the same Windows 95,  the TreeView control did NOT eat the
> Right Mouse Up message.  I just upgraded to Delphi 5, I didn't upgrade
> Windows.   It does not seem to be a Windows problem.

> Do you have any idea why ListView is also behaving strangely?

> "Right clicking a Listview the following events hapens (in this order):
> OnContextPopup, OnMouseDown, OnContextPopup,
> OnMouseUp.  In other words, an extra OnContextPopup is generated before the
> OnMouseDown. Again, it does NOT depend whether the Handled variable in the
> OnContextPopup is set to true or false".

> Thanks for your help.
> Ramiro

> Jim Kueneman wrote:

> > Ramiro Guerreiro wrote:

> > > I am experiencing the following strange behavior in Delphi 5:

> > > When right clicking a Treeview the following events happens (in this
> > > order):  OnMouseDown, OnContextPopup. The event OnMouseUp is NOT
> > > generated (no matter if the Handled variable in the OnContextPopup is
> > > set to true or false).

> > If you read the M$ docs on a Treeview it is stated that the control will eat
> > the Right Mouse up message.

> > Jim

Other Threads