Sean thanks for the info. Works like a charm after relative coordinates 
conversion with ScreenToClient() with Treeview handle.

Samuel

>Can anyone shed some light on the following?  I have a win32-gui treeview 
>control with multiple nodes.  Different nodes carry different properties 
>and there exists two context popup menu when right clicked on the control.  
>It all works well when a node is left clicked first then right clicked, the 
>correct context menu comes up.  However, when a node is right clicked 
>without left clicked first, it gives the context menu of the previously 
>selected node(which could be incorrect).  I hope this is clear enough and 
>I'd appreciate if someone can point me in the right direction.  Thanks.

Try this to make sure you have the right node:

HitTest(X, Y)
    Checks if the specified point in the TreeView area is occupied by a 
node; it returns the handle to the found node or zero if none was found. If 
called in an array context, it returns an additional value containing more 
info about the position of the specified point.

Try this to get that X and Y:

GetCursorPos()
    Returns a two elements array containing the x and y position of the 
cursor, or undef on errors.

I'm not sure whether GetCursorPos gives the relative X and Y or the screen X 
and Y; if it is the screen coordinates, you can translate it pretty easily.


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus

Reply via email to