Problem with ChangeItemProperty plugin

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Problem with ChangeItemProperty plugin

Post by Ginolard »

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?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

I am using the latest version and there's no website. I'm the guy using the menu system for an HTA, remember? ;)
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Ah yes, the Horrible Technical Application [or whatever it is :lol: ]

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
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

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??
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

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(/\&nbsp\;/ig,' ') == itemName && _m[_mi[0]][1] == menuName) break;

if (i == _mi.length) return;
_mi[codeRef] = newValue;
if (updateDisplay) BDMenu(_mi[0]);
}
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

Kevin,

Did you find anything suspicious with the code I am using?
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
Ginolard
Advanced
Advanced
Posts: 24
Joined: Wed Nov 09, 2005 11:13 am

Post by Ginolard »

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
Post Reply