menuwidth/menu item width

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
darrinh
Beginner
Beginner
Posts: 3
Joined: Wed Aug 04, 2004 5:35 am

menuwidth/menu item width

Post by darrinh »

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
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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
darrinh
Beginner
Beginner
Posts: 3
Joined: Wed Aug 04, 2004 5:35 am

Post by darrinh »

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);
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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);
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
Post Reply