maxItems when building a menu in classic mode and by javascr

Is there any way to specify through javascript that the submenu should display only a limited number of menu items with the up down scroll buttons (as per the vertical menu examples). I believe that you can do this when loading the menu definition from XML using the maxItems attribute on the menu element.



In my case, I am using classic menu mode, so I want a normal horizontal menu bar, but I want the sub menu that pops up to show just a limited number of the menu items. This menu is being built from data and I cannot know how many items there will be.


You can set the necessary limit by



menu.getPanel(id).maxItems=N;



this value will work more stabel if set before menu items added to target panel.

I tried your suggestion, but I cannot, no matter what I do, get the up down scrollers on submenus to work when the menu is created programatically.  The only way I can get these scrollers to appear is to load the menus from an XML file.  The nature of the menus I wish to implement is that they are data driven and potentially quite large, hence the need to have the scrollers.  Is there any way to get the scrollers working using scripting alone, no XML file.

Please check attached sample.
It uses additional command
         aMenuBar._scrollCheck(subMenu)
To force inner scrolls.

1212061296.zip (22.3 KB)