Problem with ChangeItemProperty plugin
Problem with ChangeItemProperty plugin
Hi all,
I'm trying to disable a single menu item in a sub-menu and am having trouble. Here's the code for the menus (well the important bit anyway)
headerbgcolor="#ffffff";
headercolor="#000000";
imagepadding=4;
offbgcolor="#eeeeee";
offcolor="#000000";
onbgcolor="#B0C4DE";
oncolor="#000099";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=100);Shadow(color=#777777', Direction=135, Strength=5)";
padding=4;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#999999";
separatorsize=1;
subimage="./images/arrow.gif";
subimagepadding=2;
}
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
position="relative";
orientation="horizontal";
style=menuStyle;
aI("image=./images/management.gif;text=Management;openonclick=1;onfunction=tab1_onclick();showmenu=MainMenuSubs;");
aI("image=./images/services.gif;text=Services & Processes;openonclick=1;onfunction=tab2_onclick();showmenu=ServProcSubs;");
aI("image=./images/users.gif;text=Users & Groups;openonclick=1;onfunction=tab3_onclick();");
aI("image=./images/software.gif;text=Software;openonclick=1;onfunction=tab4_onclick();showmenu=SoftwareSubs;");
aI("image=./images/tools.gif;text=Tools;openonclick=1;showmenu=ToolsSubs;");
aI("image=./images/help.gif;text=Help;openonclick=1;showmenu=HelpSubs");
with(milonic=new menuname("ToolsSubs")){
overflow="scroll";
style=menuStyle;
top=50;
aI("text=Export to Excel;clickfunction=ExportToExcel()");
aI("text=Compact database;clickfunction=CompactDatabase()");
I want to disable the "Export to Excel" menu item and the code I am using is as follows :-
mm_changeItemProperty("ToolsSubs","Export to Excel", 34, "disabled",1)
However, I get an error saying "_m1[...].1 is null or not an object"
What am I doing wrong?
I'm trying to disable a single menu item in a sub-menu and am having trouble. Here's the code for the menus (well the important bit anyway)
headerbgcolor="#ffffff";
headercolor="#000000";
imagepadding=4;
offbgcolor="#eeeeee";
offcolor="#000000";
onbgcolor="#B0C4DE";
oncolor="#000099";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=100);Shadow(color=#777777', Direction=135, Strength=5)";
padding=4;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#999999";
separatorsize=1;
subimage="./images/arrow.gif";
subimagepadding=2;
}
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
position="relative";
orientation="horizontal";
style=menuStyle;
aI("image=./images/management.gif;text=Management;openonclick=1;onfunction=tab1_onclick();showmenu=MainMenuSubs;");
aI("image=./images/services.gif;text=Services & Processes;openonclick=1;onfunction=tab2_onclick();showmenu=ServProcSubs;");
aI("image=./images/users.gif;text=Users & Groups;openonclick=1;onfunction=tab3_onclick();");
aI("image=./images/software.gif;text=Software;openonclick=1;onfunction=tab4_onclick();showmenu=SoftwareSubs;");
aI("image=./images/tools.gif;text=Tools;openonclick=1;showmenu=ToolsSubs;");
aI("image=./images/help.gif;text=Help;openonclick=1;showmenu=HelpSubs");
with(milonic=new menuname("ToolsSubs")){
overflow="scroll";
style=menuStyle;
top=50;
aI("text=Export to Excel;clickfunction=ExportToExcel()");
aI("text=Compact database;clickfunction=CompactDatabase()");
I want to disable the "Export to Excel" menu item and the code I am using is as follows :-
mm_changeItemProperty("ToolsSubs","Export to Excel", 34, "disabled",1)
However, I get an error saying "_m1[...].1 is null or not an object"
What am I doing wrong?
Ah yes, the Horrible Technical Application [or whatever it is ]
I am sorry. I have no idea, I don't even know what the error message means, and that function is not a Milonic creation. It was made to function with Milonic, but wasn't created by Milonic. I have posted in case someone knows or can help.
I notice there's no semi-colon at the end which it needs, but of course you may have it and just didn't put it here.
Ruth
I am sorry. I have no idea, I don't even know what the error message means, and that function is not a Milonic creation. It was made to function with Milonic, but wasn't created by Milonic. I have posted in case someone knows or can help.
I notice there's no semi-colon at the end which it needs, but of course you may have it and just didn't put it here.
Ruth
Well, it's not Horrible but that's close enough
I realise it's not a Milonic creation I was just hoping the author or someone who has used this function a lot might be able to help.
I'm guessing that it's something to do with the fact that the the menu item is an item in the ToolsSubs menu which, in itself, is a sub-item of "Main Menu". If I understand the javascript correctly (which may not be the case!) it seems that you can only change the properties of items that are one level below the top-level menu??
I realise it's not a Milonic creation I was just hoping the author or someone who has used this function a lot might be able to help.
I'm guessing that it's something to do with the fact that the the menu item is an item in the ToolsSubs menu which, in itself, is a sub-item of "Main Menu". If I understand the javascript correctly (which may not be the case!) it seems that you can only change the properties of items that are one level below the top-level menu??
Hi,
I had a look... I used your sample code; added closing } after menu defs, but other than that, everything looked good. I get no error, and the menu item does actually have the "disabled" type applied. I wonder if you could post a url to a sample page where this is happening? If not, then could you please post a copy of the code you're using to define the mm_changeItemProperty() function. Please copy it from your actual code; I have a suspicion.
BTW, the function can be used on any item in any menu, regardless of the menu's "level."
Cheers,
Kevin
I had a look... I used your sample code; added closing } after menu defs, but other than that, everything looked good. I get no error, and the menu item does actually have the "disabled" type applied. I wonder if you could post a url to a sample page where this is happening? If not, then could you please post a copy of the code you're using to define the mm_changeItemProperty() function. Please copy it from your actual code; I have a suspicion.
BTW, the function can be used on any item in any menu, regardless of the menu's "level."
Cheers,
Kevin
Here's the function I'm using. I don't know if it makes a difference but I've added it as part of the menueditapi.js (the one that allows adding/deleting of menu items on the fly). The menueditapi is then included at the <head> of the HTA.
I'll try and put a simple HTML page together somewhere in the meantime.
function mm_changeItemProperty(menuName, itemName, codeRef, newValue, updateDisplay)
{
menuName = menuName.toLowerCase();
for (i=0; i<_mi.length; i++)
if (_mi[1].replace(/\ \;/ig,' ') == itemName && _m[_mi[0]][1] == menuName) break;
if (i == _mi.length) return;
_mi[codeRef] = newValue;
if (updateDisplay) BDMenu(_mi[0]);
}
I'll try and put a simple HTML page together somewhere in the meantime.
function mm_changeItemProperty(menuName, itemName, codeRef, newValue, updateDisplay)
{
menuName = menuName.toLowerCase();
for (i=0; i<_mi.length; i++)
if (_mi[1].replace(/\ \;/ig,' ') == itemName && _m[_mi[0]][1] == menuName) break;
if (i == _mi.length) return;
_mi[codeRef] = newValue;
if (updateDisplay) BDMenu(_mi[0]);
}
Hi,
Sorry for not replying sooner... I don't think I got an email notification that you had replied to this thread. Either that, or my addled brain just missed it!
I do not see any problem with the function; it's exactly as I wrote it. Must be somethuing else. Since I can't reproduce the problem with the example code you posted, I wonder if you are able to get a test page going that exhibits the problem, so I can go check it out?
Cheers,
Kevin
Sorry for not replying sooner... I don't think I got an email notification that you had replied to this thread. Either that, or my addled brain just missed it!
I do not see any problem with the function; it's exactly as I wrote it. Must be somethuing else. Since I can't reproduce the problem with the example code you posted, I wonder if you are able to get a test page going that exhibits the problem, so I can go check it out?
Cheers,
Kevin
I can only assume it's because I am using it within an HTA rather than on a standard webpage. I've been trying to get a simple HTML page running that just displays the menu with two buttons (one to enable to the entire menu and the other to TRY and disable this single menu item) but I can't even get THAT to work....sigh