Menu problem |
Author: |
Message: |
djdannyp
Elite Member
Danny <3 Sarah
Posts: 3546 Reputation: 31
38 / /
Joined: Mar 2006
|
O.P. Menu problem
code: function OnGetScriptMenu(Location)
{
var myMenu = "<ScriptMenu>";
myMenu += "<MenuEntry Id=\"mnuNew\">New</MenuEntry>";
myMenu += "<Separator/>";
myMenu += "<MenuEntry Id=\"mnuAbout\">About...</MenuEntry>";
myMenu += "</ScriptMenu>";
return myMenu;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWind)
{
if (MenuItemId == "mnuNew") {
WndNew = MsgPlus.CreateWnd("New.xml", "mnuNew");
} else if (MenuItemId == "mnuAbout") {
WndAbout = MsgPlus.CreateWnd("About.xml", "mnuAbout");
}
that's some code I've got to make a menu (for a script that I'm probably going to need more help on once I get my head around exactly what i'm doing!)
However I can't now get the windows to show.
The menus are created properly, there's no errors in the debug window, the xml files load successfully in the tester (and I've tried substituting one for a menu window from another script which works)
I'm at a complete loss
|
|
01-21-2009 10:14 AM |
|
|
mynetx
Skinning Contest Winner
Microsoft insider
Posts: 1175 Reputation: 33
37 / /
Joined: Jul 2007
|
RE: Menu problem
jscript code: function OnEvent_MenuClicked(MenuItemId, Location, OriginWind)
{
if (MenuItemId == "mnuNew") {
WndNew = MsgPlus.CreateWnd("New.xml", "mnuNew");
} else if (MenuItemId == "mnuAbout") {
WndAbout = MsgPlus.CreateWnd("About.xml", "mnuAbout");
}
The "else if" block has no closing curled bracket.
|
|
01-21-2009 10:28 AM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Menu problem
Did you save the New.xml in Unicode?
EDIT: And what mynetx said, although you didn't mention a syntax error so I wasn't looking that deep into it
This post was edited on 01-21-2009 at 10:30 AM by Spunky.
<Eljay> "Problems encountered: shit blew up"
|
|
01-21-2009 10:30 AM |
|
|
djdannyp
Elite Member
Danny <3 Sarah
Posts: 3546 Reputation: 31
38 / /
Joined: Mar 2006
|
O.P. RE: Menu problem
There's no syntax error, I just didn't copy it properly into here, lol
and yeah, New.xml is saved as Unicode, and as I said I tried another xml file in its place from a script who's menus do load...and still nothing
it's really bizarre
This post was edited on 01-21-2009 at 11:09 AM by djdannyp.
|
|
01-21-2009 11:08 AM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: Menu problem
Just try:
code: function OnEvent_MenuClicked(MenuItemId, Location, OriginWind)
{
WndNew = MsgPlus.CreateWnd("New.xml", "mnuNew");
}
<Eljay> "Problems encountered: shit blew up"
|
|
01-21-2009 11:16 AM |
|
|
mynetx
Skinning Contest Winner
Microsoft insider
Posts: 1175 Reputation: 33
37 / /
Joined: Jul 2007
|
RE: Menu problem
Maybe you should pack us a copy of the script and attach it to let us debug it.
|
|
01-21-2009 11:18 AM |
|
|
djdannyp
Elite Member
Danny <3 Sarah
Posts: 3546 Reputation: 31
38 / /
Joined: Mar 2006
|
O.P. RE: Menu problem
Here it is
The script itself probably doesn't work yet (infact it almost certainly doesn't work)
But it's not much use if I can't load the menus, lol
It's really bizarre.....i tried using Spunky's suggested code with literally nothing else in the code (except obviously the code to construct the menu)
the OnEvent_MenuClicked does get called properly (as shown in the debut window)....but just nothing shows
Edit: Attachment removed
This post was edited on 01-21-2009 at 02:26 PM by djdannyp.
|
|
01-21-2009 12:16 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Menu problem
The problem lies in the fact that you're trying to use some kind of menu identifier as window identifier.
In your JScript:
js code: WndNew = MsgPlus.CreateWnd("New.xml", "mnuNew");
In your interfaces XML:
xml code: <Window Id="options" Version="1">
The "mnuNew" should be replaced by "options" so that Plus! can find the right window to load. Same goes for the about window: you defined it as "About" in your interfaces but you try to open "mnuAbout".
|
|
01-21-2009 12:25 PM |
|
|
djdannyp
Elite Member
Danny <3 Sarah
Posts: 3546 Reputation: 31
38 / /
Joined: Mar 2006
|
O.P. RE: Menu problem
Woo, that got it sorted.....can't believe it was something so stupid!
|
|
01-21-2009 02:26 PM |
|
|
|