[?] EditControl/Displaying Hotkeys |
Author: |
Message: |
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
O.P. [?] EditControl/Displaying Hotkeys
Does anybody know how the EditControl in the following picture is accomplished?
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"
|
|
12-05-2006 12:34 AM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
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?
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 |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
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
EDIT: Beaten to it again, I had to try it out first didn't I
This post was edited on 12-05-2006 at 12:53 AM by markee.
|
|
12-05-2006 12:53 AM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
O.P. RE: [?] EditControl/Displaying Hotkeys
OMG! I never noticed that before
Feel like a n00b
EDIT: Nah, I can't find how to read informatin from it either
This post was edited on 12-05-2006 at 01:07 AM by Spunky.
<Eljay> "Problems encountered: shit blew up"
|
|
12-05-2006 12:57 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
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 |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
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"
|
|
12-05-2006 01:25 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
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.
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 |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
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 I'll set about adding it to my own script tomorrow
<Eljay> "Problems encountered: shit blew up"
|
|
12-05-2006 02:57 AM |
|
|
|