Can't find a menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
pservedio
Advanced
Advanced
Posts: 10
Joined: Tue Sep 19, 2006 7:44 pm

Can't find a menu

Post by pservedio »

I'm trying to dynamically update the text of a menu (not its items, doesn't have any...yet).

Based upon code from the forum I added this javascript function:

Code: Select all

function mm_changeMenuProperty(menuName, propertyRef, newValue)
{
  var menuNum = getMenuByName(menuName);
  if (menuNum == null) {
        alert("could not find menu "+menuName);
  }
  _m[menuNum][propertyRef] = newValue;
  BDMenu(menuNum);
}
and in menu_data.js

Code: Select all

with(milonic=new menuname("userMenu")){
alwaysvisible=1;
screenposition="left"
left="offset=320" 
orientation="horizontal";
style=rightStyle;
top=89;
}
So when I make my call to change the menu name on the screen in a javascript function:

Code: Select all

 mm_changeMenuProperty("userMenu", 1, userName);

I get the alert that the menu can't be found. However other menus could be found.

Any help would be appreciated.

Alternatively I could create this menu dynamically, but just can seem to find that sample page. If you think that'a a better way, let me know. The name of the menu is based upon a variable, and cannot be string literal.

My milonic id is 203386, winxp sp2, firefox 1.5.0.7
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I don't think you can change the name of a menu, I believe the two things that won't work with that function are changing the name and changing the style. And it's probably not finding the menu because there's nothing in it.

What page are you seeking with regard to dynamic creation?

I did a search for mysql and dynamic menu, you can try the following links, though I have no idea if any will be of help.

http://support.milonic.com/datamenu/

http://milonic.com/xml_menu.php

http://milonic.com/createmenu.htm

viewtopic. ... 6859#36859

viewtopic. ... 6071#36071

viewtopic. ... 5147#35147

Hope this helps.

Ruth
pservedio
Advanced
Advanced
Posts: 10
Joined: Tue Sep 19, 2006 7:44 pm

Post by pservedio »

This is incredibly frustrating...OK, so I try two other strategies, as seen in your post and on the forum:

#1: I try to change the name of a menu item, based on a function written by "Kevin" I think:

Code: Select all

function mm_changeItemProperty(menuName, itemName, codeRef, newValue, updateDisplay)
{
  menuName = menuName.toLowerCase();
  for (i=0; i<_mi.length; i++)
    if (_mi[i][1].replace(/\&nbsp\;/ig,' ') == itemName && _m[_mi[i][0]][1] == menuName) break;
  if (i == _mi.length)  {
      alert("Could not find menu");
      return;
  }
  _mi[i][codeRef] = newValue;
  if (updateDisplay) BDMenu(_mi[i][0]);
}
With my menu in menu_data.js:

Code: Select all

with(milonic=new menuname("userMenu")){
alwaysvisible=1;
screenposition="left";
left="offset=320";
orientation="horizontal";
style=rightStyle;
top=89;
aI("text=uname");
}
I make this call:

Code: Select all

userName = xmlDoc.getElementsByTagName('user_name')[0].childNodes[0].nodeValue;
mm_changeItemProperty("userMenu", "uname", 1, userName, 1);
And get this error:
_mi[1] has no properties


Can't remember JS scope but perhaps the "i" variable went out of scope, not sure.

#2: Based upon your suggestion in this page:

http://milonic.com/createmenu.htm

and in the sample found in the release I just bought, I tried this:

Code: Select all

     with(milonic=new menuname("uname")){
            alwaysvisible=1;
            screenposition="left";
            left="offset=500";
            orientation="horizontal";
            style=rightStyle;
            top=89;
            aI("text="+userName+";url=;");               
            }
            mm_createNewMenus();
            popup("uname",1);
And I get an error message telling me that:
Error: "_wid" is undefied.
This also happens in the sample that you ship out!!! (In the dynamic_menus_API folder, the index.html gets the same problem, in both IE and FF).

I just bought Milonic, I assume that I'm on the latest version, so what's the deal here?

It appears that _wid is defiend in mmenusns4.js, which is fine if you're on NS4, but I couldn't find it defined anywhere else (i.e mmenudom.js)! Either I'm making some serious newbie error or your QA is sloppy!
pservedio
Advanced
Advanced
Posts: 10
Joined: Tue Sep 19, 2006 7:44 pm

Post by pservedio »

Update:

If one comments out this line in mm_menueditapi.js. mm_createNewMenus():

//if(_wid)n.width=_excMD(_wid)

The example works. That being said, it's never a good idea to muck with 3rd party software. And of course, you can't set the width property.

Can we get a working version of this method?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hello,

Can you please contact Milonic? I will post a link for Milonic to this message, but I am only a volunteer and don't do or know anything about the programming.

Ruth
pservedio
Advanced
Advanced
Posts: 10
Joined: Tue Sep 19, 2006 7:44 pm

Post by pservedio »

Ruth, thanks for your help...I assume "Andy" is Senor Milonic and will email him....

...Oops, private messaging has been disabled on this board, how can I contact him?
Post Reply