Try
IF button = 2
loNode = this.hitTest(15*x,;
15*y)
IF VARTYPE(loNode) == "O"
= MESSAGEBOX("Right Click")
ENDIF
ENDIF
>Borislav,
>
>I had looked at the MouseDown event. It does have a button parm that will tell me if the right or left button was pressed. It also passes an x and y coordinate. However, I'm having trouble determining if the user clicked on an item in the list or just in some empty space within the control.
>
>I tried doing a hittest() with the x & y parms but it doesn't seem to work the way I'm expecting.
>
>This is the code I've placed in MouseDown event:
>
>*** ActiveX Control Event ***
>LPARAMETERS button, shift, x, y
>loNode = .NULL.
>
>IF button = 2
> loNode = this.hitTest(x,y)
> IF VARTYPE(loNode) == "O"
> = MESSAGEBOX("Right Click")
> ENDIF
>ENDIF
>
>
>My understanding is that hittest is supposed to return a reference to the item in the listview that has the coordinates of x,y. However, the above code seems to work exactly opposite. If I right click on empty space in the control, it returns a ListItem object of the currently selected item.
>
>If I actually right click on the item, then hittest returns nothing.
>
>Any ideas as to how to tell what item in the list the user right clicked?
>
>Thanks for your input!
>
>Rodd
>
>>>I've been playing around with the ListView control (MSComctlLib.ListViewCtrl2). I am able to add items, display them with small icons, large icons, etc. However, I have not yet found a way to trap the right click or double click of an item.
>>>
>>>The control has a ItemClickEvent but that responds to a single click and doesn't tell if the user right or left clicked. I want to be able to open up a context sensitive menu if the user right clicks an item or launch a form if the user double clicks an item (much like the behaviour of windows explorer).
>>>
>>>Thanks for your help!
>>>
>>>Rodd
>>
>>You could use MouseDown or MouseUp events, there must be parameter that shows you what button is pressed.
>>I mostly use TreeView control and it has such parameters in these events.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.