Just wondering if it's actually possible to make a Plus! window "attach" to another Plus! window, so that you have to close the modal one first (it is called modal, isn't it)...
If anyone's interested as to how to do it, this should work.
jscript code:// make the parent window, make a variable for the child window
var WndParent = MsgPlus.CreateWnd("Interface.xml", "WndParent");
var WndChild = null;
// use any event here, this is just an example
function OnWndParentEvent_CtrlClicked(PlusWnd, ControlId)
{
if (ControlId === "BtnConfirm")
{
// create the child, disable and monitor the parent
WndChild = MsgPlus.CreateWnd("Interface.xml", "WndChild");
Interop.Call("user32", "EnableWindow", WndParent.Handle, false);
WndParent.RegisterMessageNotification(0x0006);
}
}
// when the parent window is focused
function OnWndParentEvent_MessageNotification(PlusWnd, Message, wParam, lParam)
{
if (wParam !== 0)
{
try
{
// focus the child window
Interop.Call("user32", "SetFocus", WndChild.Handle);
Interop.Call("user32", "BringWindowToTop", WndChild.Handle);
}
catch (error)
{
}
}
}
function OnWndChildEvent_CtrlClicked(PlusWnd, ControlId)
{
switch (ControlId)
{
case "BtnOk":
// do whatever here, then close the child
PlusWnd.Close(1);
break;
}
}
function OnWndChildEvent_Destroyed(PlusWnd, ExitCode)
{
// enable and focus the child window
Interop.Call("user32", "EnableWindow", WndParent.Handle, true);
Interop.Call("user32", "SetFocus", WndParent.Handle);
}
xml code:<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd">
This is the op of the thread I linked to. Not sure if it works in this scenario or not.
quote:Originally posted by Dempsey
Is it possible to open a modal window in front of an existing window?
Eg I have my prefs window and the I open a smaller window.
I use EnableWindow to disable the main prefs window, but If I then switch to another program and then select the window in the taskbar, I just see the disabled Prefs window which i can't obviously do anything with, and as the other window is small it's hidden behind it.
How can I do it like for example the plus prefs do it when downloading script documentation etc, which keeps the mini-window on top even when switching to another program and back again.
I have tried it by switching programs and then back again using the taskbar (and Atl+Tab), and they both seem to work. Probably because mine focuses the child and brings it to the top.