Home - Forums-.NET - FlyTreeView (ASP.NET) - ConText Menu Position

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

ConText Menu Position
Link Posted: 21-Jul-2008 14:02
I have been experimenting with using a FlyTreeView within a custom "Floating panel" control, and it appeared not to be working, but after a while I found that it was working - except that the context menu was rendering off screen. By moving the floating panel about I could get the context menu to appear onscreen and everything worked fine. Is there any way to control where the context menu renders? The CflyContextMenu object doesn't seem to have any members to access position properties - it just seems to appear at some random distance below and right of the mouse right-click.
Link Posted: 21-Jul-2008 18:52
When calculating context menu position, flyTreeView uses function depending on a browser.
For example for Y:
event.clientY + body.scrollTop (or just event.pageY if browser supports pageY)

Can you provide a sample code to reproduce the issue?
Link Posted: 22-Jul-2008 08:36
The "floating panel" is part of a licensed Application Development Framework and it would not be practical to pull it apart and make a standalone VS project.
I have sent a zip file of a webpage created using IE's "save as" function. It's a nightmare to read, but it does exhibit the strange context menu behavior:
It would appear that the context menu appears at the 2*clientX and 2*clientY or something like that. The page will open with the panel at the upper left of the browser, and the context menu operates as expected, but if you drag the panel elsewhere, then the problem becomes evident.
It seems to do the same thing in Firefox even though it should not happen when pageX is available, and I discovered a secondary issue with Firefox: a right-click on the flyTreeView displays both the flyTreeviewContextmenu and the browser's context menu.


Thank you for looking into this problem. It may not be fixable as it could be an issue with the floating panel component.

Berndt Nording
Link Posted: 22-Jul-2008 08:45
Berndt,

Thank you. I received your files. Though I didn't succeed in reproducing the issue. I tried to extract it to different locations, with no success. D&D doesn't work in FF and IE. Always JS exceptions is thrown.

Anyway I have idea. Can you try to place FlyContextMenu instances outside of dragged element? And see what happens?
Link Posted: 22-Jul-2008 11:34
That's an excellent idea, should have thought of that myself. Works like a charm in IE, but that other problem with Firefox showing the browser context meny is still there, only now the flyTreeContextMenu is not visible - probably underneath the browser menu.
I tried adding a call to the following function:

function disableContextMenu(element) {
    element.oncontextmenu = function() {
  return false;
    }
}

But it didn't help. I have heard that Firefox does not allow you to turn off the context menu, so maybe that's it.

Thanks!
Link Posted: 22-Jul-2008 18:40
you should better try event.preventDefault().
return false is IE style.