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:18
Problem with ChangeItemProperty plugin
Poster: Ginolard
Dated: Friday January 13 2006 - 9:59:45 GMT
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?
Poster: Ruth
Dated: Friday January 13 2006 - 21:48:24 GMT
Hi,
Nothing seems wrong, could you post a url so we can see what's up on the actual page? One thought, check your menu version and make sure you have the latest version.
Ruth
Poster: Ginolard
Dated: Saturday January 14 2006 - 17:09:28 GMT
I am using the latest version and there's no website. I'm the guy using the menu system for an HTA, remember?
Poster: Ruth
Dated: Sunday January 15 2006 - 2:41:58 GMT
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
Poster: Ginolard
Dated: Monday January 16 2006 - 8:26:18 GMT
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??
Poster: kevin3442
Dated: Tuesday January 17 2006 - 18:38:54 GMT
Ginolard wrote:
... I was just hoping the author or someone who has used this function a lot might be able to help.
Hi,
I wrote it. I'll have a look.
Kevin
Poster: kevin3442
Dated: Tuesday January 17 2006 - 18:51:51 GMT
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
Poster: Ginolard
Dated: Wednesday January 18 2006 - 8:51:14 GMT
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[i][1].replace(/\ \;/ig,' ') == itemName && _m[_mi[i][0]][1] == menuName) break;
if (i == _mi.length) return;
_mi[i][codeRef] = newValue;
if (updateDisplay) BDMenu(_mi[i][0]);
}
Poster: Ginolard
Dated: Friday January 20 2006 - 9:29:21 GMT
Kevin,
Did you find anything suspicious with the code I am using?
Poster: kevin3442
Dated: Saturday January 21 2006 - 0:40:55 GMT
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
Poster: Ginolard
Dated: Monday January 23 2006 - 8:38:38 GMT
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