What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - CreatePopupMenu sub-menus?

HELP - CreatePopupMenu sub-menus?
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: HELP - CreatePopupMenu sub-menus?
You create a submenu with CreatePopupMenu, add items to it and then pass the handle to AppendMenuW to add it to your main menu.

However, if you prefer to avoid all this hassle, you can simply go and get the Menu class I made for Countdown Live. The only required change is that you must change this line:
Javascript code:
var subclass = MsgPlus.CreateWnd('Interfaces\\WndSubclass.xml', 'WndSubclass', 2);

to your own subclass creation code.

Example usage:
Javascript code:
// Menu callback
var MenuCallback = function(ItemId) {
    Debug.Trace("Item "+ItemId+" was clicked");
};
 
// Create main menu
var MainMenu = new Menu(MenuCallback);
MainMenu.AddMenuItem("ItemOne", "Hello world!");
MainMenu.AddMenuItem("ItemTwo", "Lorem ipsum");
 
// Create and add a submenu
var SubMenu = MainMenu.CreateSubMenu();
SubMenu.AddMenuItem("SubitemOne", "Sub item 1");
SubMenu.AddMenuItem("SubitemTwo", "Sub item 2");
MainMenu.AddSubMenu(SubMenu, "A sub menu");
 
// Open the menu on the current cursor position
MainMenu.Open();


Example subclass window code:
XML code:
<?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd">
    <!-- SUBCLASS WINDOW -->
    <Window Id="WndSubclass" Version="1">
        <Attributes>
            <ShowInTaskbar>false</ShowInTaskbar>
        </Attributes>
        <Position Width="0" Height="0"/>
        <DialogTmpl/>
    </Window>
</Interfaces>


.txt File Attachment: Menu.js.txt (27.96 KB)
This file has been downloaded 170 time(s).
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
10-08-2009 07:36 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
HELP - CreatePopupMenu sub-menus? - by whiz on 10-08-2009 at 07:07 PM
RE: HELP - CreatePopupMenu sub-menus? - by Matti on 10-08-2009 at 07:36 PM
RE: HELP - CreatePopupMenu sub-menus? - by whiz on 10-08-2009 at 07:48 PM
RE: HELP - CreatePopupMenu sub-menus? - by Spunky on 10-08-2009 at 07:54 PM
RE: HELP - CreatePopupMenu sub-menus? - by whiz on 10-09-2009 at 06:08 PM


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