Problem with coordinates and scroll bar

Hi



Iam trying out to implemet the right click functionality for my DHTML tree.

All that i have created is a div and have set the onRightClick function for the tree to invoke this div.

            

tree1=new dhtmlXTreeObject(“treeboxbox_tree1”,“100%”,“100%”,0);

            tree1.setOnRightClickHandler(_rclick);

Now the menu comes very fine with the right click and is invoked at the co-ordinates that i receive from the clientX and clientY of the event object.





node = document.getElementById(“myDearMenu”);

node.style.left = newX+‘px’;

node.style.top = newY + ‘px’;

node.style.position = ‘relative’;



But when i scroll my tree down, i see a peculiar problem though my co-ordinates are still the same for the new location the menu pertains to be at the older location only.

i.e, If i have say 15 nodes in my tree and i have right-clicked on the 3rd node and got the coordinates as (10,20) now, when i scroll my tree down and say get the 15th node to the current 3rd node position and right click i am surprised to see that though my co-ordinates of click are still same (10,20) my menu remains to be at the inital value (i.e 3rd node and hence is displayed in the top of the tree).



In short i feel that my scroll is some how ineffective to the tree coordinates though the window event is properly updating the coordinate values.



Please help me as to where am i going wrong

Also let me knw if( iam trying to reinvent the wheel as if) there is any already available rightclick menu option with DHTML tree…



Regards

clientX and clientY are coordinates related to all in-browser area, they not affected by scroll state ( in-tree scroll, or any other scroll on the page )
dhtmlx.com/docs/products/dhtmlxT … 6936529000