Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to programatically activate a menu

    I'm doing a custom key handler with registerKey, and would like to show a menu in response. Calling menu.show() works, but doesn't position the menu properly below the menubar unless the menu has previously been show by actually clicking the menu button in the menu bar. I expected to find a function like MenuBar.PostMenu(menuNum) or MenuBar.getMenu(0).showMenu(), but couldn't find anything.

    Is there any easy way show a menu without clicking on it?

    Pete

    #2
    Do you already know about MenuItem.keys and the accessKey property? You may be trying to reproduce something that's built-in.

    Comment


      #3
      I am interested with this issue too, as I am looking to control the menu using mouseover and mouseout

      When triggering the menu with mouseover, submenus show on the far left of the screen instead of being under the button.
      But once clicking on the menubutton, the menu shows at the right place.


      Here is a minimal code that shows the problem

      Code:
      isc.Menu.create({
      ID: "my_menu",
      autoDraw: false,
      showShadow: true,
      shadowDepth: 10,
      title: "Run",
      data: [
      {title: "my_menu_1"},
      {title: "my_menu_2"}
      ]
      });
      
      isc.MenuButton.create({
      ID: "menuButtonRun",
      title: "Run",
      left:200,
      width: 100,
      menu: my_menu
      });
      
      mouseIN=function() {
      this.menu.show();
      }
      mouseOUT=function() {
      isc.Menu.hideAllMenus();
      }
      
      menuButtonRun.mouseOver=mouseIN;
      menuButtonRun.menu.mouseOut=mouseOUT;
      (this is also the object of the following thread
      => http://forums.smartclient.com/showthread.php?p=66491)
      Last edited by jerome915; 15 Oct 2011, 02:50.

      Comment


        #4
        Solution from the other thread:

        Just use
        menuButtonRun.showMenu();
        instead of
        menuButtonRun.show();

        Comment

        Working...
        X