Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
980
ContextMenu: Smart drop down
posted

Hi,

We use WebDataMenu as ContextMenu for Tree after migrating from UltraWebMenu. Tree was also changed from UltraWebTree to WebDataTree. But when clicking near the edge of the window old menu appears "smartly", managing to render itself completely inside the window. And new menus left upper angle appears always at the point of the click. 

Here's the code:

Old function:

function UltraWebTree1_NodeClick(treeId, nodeId, button){
   var node = igtree_getNodeById(nodeId);
   var tree = igtree_getTreeById(treeId);
   tree.setSelectedNode(node);

   if(button == 2){
       igmenu_showMenu('UltraWebMenu1', tree.event); 
       return true;
   }
}

new function:

function WebDataTree1_NodeClick(sender, e) {
    if (e.get_browserEvent() != null &&
       e.get_browserEvent().button == 2) {
      var menu = $find("WebDataMenu1");

      if (menu != null) {
          e.set_cancel(true);
          menu.showAt(null, null, e.get_browserEvent());
          return true;
      }        
    }
}

It's clear why the new menu (left side of the picture) draws so - it gets coordinates from e.get_browserEvent(). But how old menu managed to draw smartly? How to reproduce this behaviour? 

I also attach screenshot file.