What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help!] Menu Troubles

Pages: (2): « First [ 1 ] 2 » Last »
[Help!] Menu Troubles
Author: Message:
fergofrog
Full Member
***

Avatar

Posts: 121
Reputation: 4
31 / Male / –
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.
[Image: fergofrog.png][Image: repute.gif]
07-17-2006 01:33 AM
Profile E-Mail PM Web Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
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
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: [Help!] Menu Troubles
EDIT: Beat me to it :P

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
Profile PM Find Quote Report
fergofrog
Full Member
***

Avatar

Posts: 121
Reputation: 4
31 / Male / –
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');
}
}

[Image: fergofrog.png][Image: repute.gif]
07-17-2006 01:41 AM
Profile E-Mail PM Web Find Quote Report
fergofrog
Full Member
***

Avatar

Posts: 121
Reputation: 4
31 / Male / –
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.
[Image: fergofrog.png][Image: repute.gif]
07-17-2006 01:52 AM
Profile E-Mail PM Web Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
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
Profile E-Mail PM Web Find Quote Report
fergofrog
Full Member
***

Avatar

Posts: 121
Reputation: 4
31 / Male / –
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');
}

[Image: fergofrog.png][Image: repute.gif]
07-17-2006 02:10 AM
Profile E-Mail PM Web Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
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
Profile E-Mail PM Web Find Quote Report
fergofrog
Full Member
***

Avatar

Posts: 121
Reputation: 4
31 / Male / –
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);
}

[Image: fergofrog.png][Image: repute.gif]
07-17-2006 03:07 AM
Profile E-Mail PM Web Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
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
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On