What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] EditControl/Displaying Hotkeys

[?] EditControl/Displaying Hotkeys
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. Roll Eyes  [?] EditControl/Displaying Hotkeys
Does anybody know how the EditControl in the following picture is accomplished?

[Image: attachment.php?pid=759128]

I need it for a config window :(

This post was edited on 12-05-2006 at 01:15 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-05-2006 12:34 AM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [?] EditControl/Displaying Hotkeys
quote:
Originally posted by SpunkyLoveMuff
Does anybody know how the EditControl in the following picture is accomplished?

[Image: attachment.php?pid=759128]

I need it for a config window :(

It isn't...

What I mean is it isn't an "EditControl", but a "HotKeyControl".
See Official Plus! Scripting Documentation > XML Schemas Reference > Interface Windows > Schema Documentation.

This post was edited on 12-05-2006 at 12:49 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-05-2006 12:49 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [?] EditControl/Displaying Hotkeys
I'm not sure about what it returns but the coding for the XML is quite simple.

code:
<Control xsi:type="HotKeyControl" Id="hot">
        <Position Left="200" Top="50" Width="40" Height="15"/>
</Control>

Have fun with it :cheesy:

EDIT: Beaten to it again, I had to try it out first didn't I :sad:

This post was edited on 12-05-2006 at 12:53 AM by markee.
[Image: markee.png]
12-05-2006 12:53 AM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [?] EditControl/Displaying Hotkeys
OMG! I never noticed that before :o

Feel like a n00b :(

EDIT: Nah, I can't find how to read informatin from it either :S

This post was edited on 12-05-2006 at 01:07 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-05-2006 12:57 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] EditControl/Displaying Hotkeys
And you need to use SendMessage along with WM_SetHotKey and WM_GetHotKey messages to read and set the text.

This post was edited on 12-05-2006 at 01:27 AM by matty.
12-05-2006 01:20 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [?] EditControl/Displaying Hotkeys
* Spunky breaks down and cries :'(

In good old "Spunky Style", I'll give it a bash

EDIT: In good old "SPunky Style", I failed :(

This post was edited on 12-05-2006 at 01:42 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-05-2006 01:25 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] EditControl/Displaying Hotkeys
Window.xml code:
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" Name="Hotkey Example">
    <Window Id="Window" Version="1">
        <Attributes>
            <Caption>Hotkey Example</Caption>
        </Attributes>
        <TitleBar>
            <Title><Text></Text></Title>
        </TitleBar>
        <Position Width="186" Height="80"/>
        <DialogTmpl>
            <BottomBar Style="Plain">
                <LeftControls>
                    <Control xsi:type="ButtonControl" Id="BtnCancel">
                        <Position Left="0" Top="0" Width="50"/>
                        <Caption>Cancel</Caption>
                    </Control>
                </LeftControls>
                <RightControls>
                    <Control xsi:type="ButtonControl" Id="btnAdd">
                        <Position Left="0" Top="0" Width="50"/>
                        <Caption>Add</Caption>
                    </Control>
                </RightControls>
            </BottomBar>
        </DialogTmpl>
        <Controls>
            <Control xsi:type="StaticControl" Id="lbl1">
                <Position Top="7" Left="5" Width="60" Height="10" />
                <Caption>Hotkey:</Caption>
                <Attributes>
                    <AutoAdjustWidth>true</AutoAdjustWidth>
                </Attributes>
            </Control>
            <Control xsi:type="HotKeyControl" Id="hkHotKeyCombination">
                <Position Top="5" Left="40" Width="130" />
            </Control>
        </Controls>
    </Window>
</Interfaces>

Script Code
code:
var WM_USER = 0x0400;
var HK_GETKEY = (WM_USER+2);
var HK_SETKEY = (WM_USER+1);
var _mKey;

function OnWindowEvent_CtrlClicked(pPlusWnd, sControlId){
    if (sControlId == 'btnAdd'){
        _mKey = Interop.Call('user32','SendMessageW', pPlusWnd.GetControlHandle('hkHotKeyCombination'), HK_GETKEY, 0, 0);
        Debug.Trace(hibyte2modkey(hibyte(_mKey)) + '+' + lobyte2key(lobyte(_mKey)));
    }
}

function OnGetScriptMenu(nLocation){
    sMenu = '<ScriptMenu><MenuEntry Id="test">Test Window</MenuEntry></ScriptMenu>';
}

function OnEvent_MenuClicked(sMenuId, nLocation, ChatWnd){
    if (sMenuId == 'test'){
        var pPlusWnd = MsgPlus.CreateWnd('Window.xml', 'Window');
        Interop.Call('user32', 'SendMessageW', cTmp.GetControlHandle('hkHotKeyCombination'), HK_SETKEY, _mKey, 0);
    }
}
   
function hibyte2modkey(w){
    switch(w){
        case 1:
            return 'Shift';
            break;
        case 2:
            return 'Ctrl';
            break;
        case 3:
            return 'Ctrl + Shift';
            break;
        case 4:
            return 'Alt';
            break;
        case 5:
            return 'Alt + Shift';
            break;
        case 6:
            return 'Ctrl + Alt';
            break;
        case 7:
            return 'Ctrl + Shift + Alt';
            break;
    }
}

function lobyte2key(w){
    if (w >= 49 && w <= 91){
        return String.fromCharCode(w);
    }
    else if (w >= 112 && w <= 123){
        return 'F'+(w - 111);
    }else{ return w; }
}

function lobyte(w){ return w & 0xff; }
function hibyte(w){ return w >> 8; }

Again like normal I am doing this while at work no way to test it.

.plsc File Attachment: Hotkey Example.plsc (1.83 KB)
This file has been downloaded 124 time(s).

This post was edited on 12-05-2006 at 02:43 AM by matty.
12-05-2006 02:43 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
O.P. RE: [?] EditControl/Displaying Hotkeys
quote:
Originally posted by Matty
Again like normal I am doing this while at work no way to test it.

Ok thanks for the code Matty. Had to add a closing brace at the end of the script (it's included above though) and had to change cTmp to pPlusWnd, but it works :p I'll set about adding it to my own script tomorrow
<Eljay> "Problems encountered: shit blew up" :zippy:
12-05-2006 02:57 AM
Profile PM Find Quote Report
« 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