I had this problem:
I needed to append to the menu many items, after the call to "drawMenus();"
I have some prorblems with the "mm_insertItem" :
- it doesen't seem to work well if I call after drawMenus and I have added many items with aI before)
- it works well if I call it after the drawmenu without using aI (with more than 1 item per submenu)
- in the last case, it is very very slow due to the many "for"
I created this script, that seem to work well (using some tricks) to append item to menu:
Code: Select all
function mm_appendItem(_mN, _aI)
{
_mn=_mN;
// -- Add the Menu Item --
var new_item_id=_mi.length;
_mi[new_item_id]=_nA();
// Copying from item 0 (must be empty)
_mi[new_item_id][0]=_mn;
for(_r=2;_r<_mi[0].length;_r++)
{
_mi[new_item_id][_r]=_mi[0][_r];
}
// Apply Style and proprieties in _aI
_it=_aI.split(";");
for(_r=0;_r<_it.length;_r++){
_sp=_it[_r].indexOf("=");
if(_sp>-1){
_si=_it[_r].slice(_sp+1);
_w=_it[_r].slice(0,_sp);
if(_w=="showmenu")_si=$tL(_si);
_mi[new_item_id][_$S[_w]]=_si;
}
}
// -- Add the Item to the Menu Item List --
var x = _m[_mn][0];
x[x.length]=new_item_id;
// Redraw
try {
_rbMenus(_mn);
}
catch(er)
{
}
}
Code: Select all
var _mNOld="";
var _mnOld=0;
function AddItem(_mN,_aI)
{
if(_mNOld==_mN) mm_appendItem(_mnOld,_aI);
else
{
_mNOld=_mN;
_mnOld=getMenuByName(_mN);
mm_appendItem(_mnOld,_aI);
}
}
So you have to add as first item in your data js:
Code: Select all
with(menufff=new menuname("MenuBlank"))
{
aI("");
}
I didn't find any solution to the problem reading this: viewtopic.php?t=5451
Please avoid unusefull "for", thanks
PS: I bought Milonic professional license, is it possible to get a clear source? I will give you all my modifications...
[/url]