Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:15
menuwidth/menu item width
Poster: darrinh
Dated: Tuesday August 17 2004 - 7:10:59 BST
hi,
we are using milonic with the menu data being dynamic generated, that also dynamically resizes and sets scrollbars if the menu data is to long, so the menu doesnt overlap the page footer image (contains corporate logos that they dont want covered up), this works quite well, but the issue i have is that when the scroll bars come on,id like to dyanamically reset the menu width to be current width - scroll bar width, however, nothing i have tried has an effect on the width, it seems once the menu's have been contructed, the width cannot be changed, i did see a mention that some propertie changes required the menu to be refreshed, is there such a function, like redraw or refresh?
thanks
Poster: Andy
Dated: Tuesday August 17 2004 - 22:23:34 BST
Hi,
The function for redrawing menus is BDMenu(menunumber).
You need to know the menu number in order to redraw the menu and this can be found by using the getMenuByName("menuname") function.
You could try this.
menunumber=getMenuByName("samplemenu")
_m[menunumber][4]=200 // changes the width to 200 pixels
BDMenu(menunumber) // redraws the menu
Hope this helps
-- Andy
Poster: darrinh
Dated: Wednesday August 18 2004 - 2:02:54 BST
thanks Andy, that hit the spot!. althought it seems you have to prepend "menu" to the returned value of getMenuByName in order
to get a valid menu object.
eg:
var menuName = getMenuByName("Main Menu");
var menuObj = gmobj("menu"+menuName);
m[menuName][4] = 200;
BDMenu(menuName);
Poster: kevin3442
Dated: Friday August 20 2004 - 23:28:39 BST
darrinh wrote:
...althought it seems you have to prepend "menu" to the returned value of getMenuByName in order to get a valid menu object. eg:
var menuName = getMenuByName("Main Menu");
var menuObj = gmobj("menu"+menuName);
m[menuName][4] = 200;
BDMenu(menuName);
var menuName = getMenuByName("Main Menu");
var menuObj = gmobj("menu"+menuName);
m[menuName][4] = 200;
BDMenu(menuName);
True, if you need to get a reference to a menu object (e.g., to use the gpos() or spos() functions). But you don't need a menu object to use the BDMenu() function, just a menu number -- an integer used as an index into the _m[] array -- which is what getMenuByName() returns. So, although it won't hurt (just an extra concatenation and function call), the second line of code above isn't necessary to use BDMenu().
Cheers,
Kevin