[Help!] Menu Troubles |
Author: |
Message: |
fergofrog
Full Member
Posts: 121 Reputation: 4
31 / / –
Joined: May 2006
|
O.P. [Help!] Menu Troubles
I am having some menu troubles with my script, here is my code (only for the menu):
code: function OnGetScriptMenu (Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"MnuAbout\">About...</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked ("MnuAbout", Location, OriginWnd)
{
MsgPlus.CreateWnd('Window.xml', 'About');
}
When activating the script it says i have an error if i remove the:
code: function OnEvent_MenuClicked ("MnuAbout", Location, OriginWnd)
{
MsgPlus.CreateWnd('Window.xml', 'About');
}
It works again and if i just rename the "MnuAbout" to MenuItemId it works again. I just want the about button to work.
This post was edited on 07-17-2006 at 01:33 AM by fergofrog.
|
|
07-17-2006 01:33 AM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: [Help!] Menu Troubles
code: function OnEvent_MenuClicked (MnuId, Location, OriginWnd)
{
if(MnuId == "MnuAbout")
MsgPlus.CreateWnd('Window.xml', 'About');
}
You can't have quotes where a variable should be, but the above should make sense.
|
|
07-17-2006 01:35 AM |
|
|
deAd
Scripting Contest Winner
Posts: 1060 Reputation: 28
– / /
Joined: Jan 2006
|
RE: [Help!] Menu Troubles
EDIT: Beat me to it
code: function OnEvent_MenuClicked (MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "MnuAbout"){
MsgPlus.CreateWnd('Window.xml', 'About');
}
}
This post was edited on 07-17-2006 at 01:37 AM by deAd.
|
|
07-17-2006 01:36 AM |
|
|
fergofrog
Full Member
Posts: 121 Reputation: 4
31 / / –
Joined: May 2006
|
O.P. RE: [Help!] Menu Troubles
Neither of those 2 worked. I got the same error. Here is my code now (just the menu):
code: function OnGetScriptMenu (Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"MnuAbout\">About...</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked (MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "MnuAbout"){
MsgPlus.CreateWnd('Window.xml', 'About');
}
}
|
|
07-17-2006 01:41 AM |
|
|
fergofrog
Full Member
Posts: 121 Reputation: 4
31 / / –
Joined: May 2006
|
O.P. RE: RE: [Help!] Menu Troubles
quote: Originally posted by BstrdSmkr
quote: Originally posted by fergofrog
Neither of those 2 worked. I got the same error. Here is my code now (just the menu):
code: function OnGetScriptMenu (Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"MnuAbout\">About...</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked (MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "MnuAbout"){
MsgPlus.CreateWnd('Window.xml', 'About');
}
}
change the second set of double quotes to single quotes on line 3:
code: ScriptMenu += "<MenuEntry Id=\"MnuAbout\">About...</MenuEntry>";
should be:
code: ScriptMenu += "<MenuEntry Id=\'MnuAbout\'>About...</MenuEntry>";
see if that works
No that didn't work, the problem is in the OnEvent_MenuClicked i think.
|
|
07-17-2006 01:52 AM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: [Help!] Menu Troubles
I don't think that'll work. It shouldn't matter, and I'm not sure if ' is valid for xml.
This code should work, I can't exactly test it as I dont' have plus at the moment but I'm 99% sure its valid.
code: function OnGetScriptMenu(Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"MnuAbout\">About...</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "MnuAbout")
MsgPlus.CreateWnd('Window.xml', 'About');
}
|
|
07-17-2006 01:53 AM |
|
|
fergofrog
Full Member
Posts: 121 Reputation: 4
31 / / –
Joined: May 2006
|
O.P. RE: [Help!] Menu Troubles
The script is working, only when i click on About... it doesn't open any thing. Here is my script so far (only them menu part):
code: function OnGetScriptMenu(Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"MnuAbout\">About...</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "MnuAbout")
MsgPlus.CreateWnd('Window.xml', 'About');
}
|
|
07-17-2006 02:10 AM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: [Help!] Menu Troubles
Is the xml saved as Unicode? Open in wordpad then save as unicode. If it still doesn't work then its a problem with your xml.
|
|
07-17-2006 02:12 AM |
|
|
fergofrog
Full Member
Posts: 121 Reputation: 4
31 / / –
Joined: May 2006
|
O.P. RE: [Help!] Menu Troubles
Thanks heaps that unicode thing worked! How do i get my Close button to work i have in Window.xml:
code: <Control xsi:type="ButtonControl" Id="BtnClose">
<Position Left="112" Top="25" Width="50"/>
<Caption>Close</Caption>
</Control>
And in my script i have:
code: function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnClose")
Wnd.Close(1);
}
|
|
07-17-2006 03:07 AM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: [Help!] Menu Troubles
code: function OnAboutEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnClose")
Wnd.Close(1);
}
Thats assuming the window in the xml file is called About
|
|
07-17-2006 03:09 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|