* CookieRevised slaps Matty around a bit with a wet trout (my turn to slap now )
quote:
Originally posted by Matty
Change the bolded part to "BtnCancel"code:
<Control xsi:type="ButtonControl" Id="BtnClose">
<Position Left="112" Top="25" Width="50"/>
<Caption>Close</Caption>
BtnCancel is built into Messenger Plus! Live Scripting that when clicked it will close the window.
nevertheless, the button should work, no matter what you named it, as long as you use the same id in the script...
So this isn't the error he has made... it was correct what he did...
quote:
Originally posted by Matty
Or with your codecode:
function OnWndTestEvent_CtrlClicked(Wnd, ControlId) {
Debug.Trace("Hello World!");
if(ControlId == "BtnClose"){
Debug.Trace("woot");
Wnd.Close(0);
}
}
It doesn't matter what parameter you give to the Close() function. The parameter is a custom exit code which you can define whatever you want.
So this isn't the error he has made... it was correct what he did...
quote:
Originally posted by Matty
Or with the Windows APIcode:
var WM_CLOSE = 0x10;
function OnWndTestEvent_CtrlClicked(Wnd, ControlId) {
Debug.Trace("Hello World!");
if(ControlId == "BtnClose"){
Debug.Trace("woot");
Interop.Call('user32', 'SendMessageW', Wnd.Handle, WM_CLOSE, 0, 0);
}
}
Even with this code it will still not work...
because:
quote:
Originally posted by DarkGhost
function OnEvent_MyStatusChange()
{
var Wnd = MsgPlus.CreateWnd("InterfaceTest.xml", "schange");
}
function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
{
Debug.Trace("Hello World!");
if(ControlId == "BtnClose") Wnd.Close(1);
Debug.Trace("woot");
}
He forgot to change the name of the window id in the event function name which he took from the example in the scripting documentation.
The event function must be:
function On
schangeEvent_CtrlClicked(Wnd, ControlId)
* CookieRevised goes to sleep now too...