Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:28

Want to get Parent of a menu


Poster: Godzidave
Dated: Tuesday October 18 2005 - 20:08:49 BST

Hi, I have two menus (one is use like a tooltip message), and for this tooltip menu I want to know which menu is this menu parent.

For example, here is my code

Quote:
with(milonic=new menuname("Menu1")){
alwaysvisible=1;
left=400;
style=menuStyle;
top=30;
orientation="horizontal";
aI("text=David;type=dragable;pointer=move;showmenu=mnuDavid");
}
with(milonic=new menuname("Menu2")){
alwaysvisible=1;
left=400;
style=menuStyle;
top=60;
orientation="horizontal";
aI("text=Michel;type=dragable;pointer=move");
}
with(milonic=new menuname("mnuTooltip")){
left="offset=20";
style=tooltipStyle;
orientation="horizontal";
aI("text=David Lavallée");
}


Here, Menu1 have mnuToolTip as a tooltip menu, and I want to find a way that when I have the item aI("text="David Lavallée"); from the _mi array, I want to find his parent.

Hope I'm clear...

If anybody could help, would be much appreciate

Thanx[/quote]


Poster: Andy
Dated: Friday October 21 2005 - 13:03:04 BST

Hi,

The following should return the reference number for a menuitems parent menu:

var parentMenu=getParentMenuByItem(_itemRef)

Then, you can call this menus array by either _m[parentMenu] or the object itself by gmobj("menu"+parentMenu)

Hope this helps,
Andy


Poster: Godzidave
Dated: Monday October 24 2005 - 14:29:15 BST

Yeah, I found this function by searching the web site... but my question was more about how getting the _itemref?? Sorry if I did not make myself clear... :oops:

I'm french so sometime, I can't explain my question real clear...

Hope i'm clear this time :)


Poster: Andy
Dated: Monday October 24 2005 - 16:33:46 BST

_itemRef is a global value that is always -1 unless you a menu item is active in which case it is the reference number to the menu item.

It's all pretty much automatic


Poster: Godzidave
Dated: Monday October 24 2005 - 19:01:18 BST

Oh, didn't know about that.

Thanx, I'll give it a try!! :)


Poster: sbraun
Dated: Wednesday December 13 2006 - 13:50:11 GMT

Andy wrote:
Hi,

The following should return the reference number for a menuitems parent menu:

var parentMenu=getParentMenuByItem(_itemRef)

Then, you can call this menus array by either _m[parentMenu] or the object itself by gmobj("menu"+parentMenu)

Hope this helps,
Andy






Hello Andy,
I don't know javascript, but I'de like to use this function "var parentMenu=getParentMenuByItem(_itemRef)"

Where do I use it and how?

Thanks for any...
sbraun


Poster: rjmjr9
Dated: Wednesday December 13 2006 - 18:43:46 GMT

Andy wrote:
_itemRef is a global value that is always -1 unless you a menu item is active in which case it is the reference number to the menu item.

It's all pretty much automatic



If I understand you -

_itemref is the item number of an item within a speciifc menu and it not an array of all items of all menus on a page. For ex:

menu 1 has 3 items. each item has a showmenu to show a sub menu.

the _itemref that is equal 1 for menu 1 is the first item that is listed in the menu data file.

SO the _itemref that is equal to 1 for a submenu means that it is the first menu item listed in the menu data file for that sub menu. it does not consider the parent menu. _itemref refers only to the menu item wher it was called.

therefore, in this case

aI("clickfunction=getParentMenuByItem(3);"); in the third item on the third submenu of menu 1 will return the parent "menu1"

Is this correct:

If not could you explain how items get their _itemref.

thanks.


Poster: Andy
Dated: Tuesday December 19 2006 - 12:06:06 GMT

Quote:
If I understand you

_itemref is the item number of an item within a speciifc menu and it not an array of all items of all menus on a page. For ex:

menu 1 has 3 items. each item has a showmenu to show a sub menu.

the _itemref that is equal 1 for menu 1 is the first item that is listed in the menu data file.


No, _itemRef is the global item number so if there are 100 menu items in the whole of the menu and the last menu item is highlighted, _itemRef will have a value of 99 (99 because 0 is counted as 1 and so on)

In irder to return the items location within the menu, you would need to use a function such as this:

Code:
function mm_returnItemPos(i){
   var M=_m[_mi[i][0]][0]
   for(var a=0;a<M.length;a++)if(M[a]==i)return a;
   return -1
}