Shoutbox

Active Dialog Window? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Active Dialog Window? (/showthread.php?tid=86093)

Active Dialog Window? by a0369 on 09-22-2008 at 05:21 PM

Here's what I'm trying to do, but have no clue how to do it. In some windows on Messenger Plus, you can click a button and it will bring up a dialog and while that dialog is on the screen you are not allowed to click the main window until you close the dialog, is there a way to do this same behavior in scripting?


RE: Active Dialog Window? by Matti on 09-22-2008 at 05:40 PM

Could you give us an example? Do you mean a modal dialog box, like this:
[Image: ms644996.MessageBox_01(en-us,VS.85).png]
or do you mean that you want a Plus! window created by MsgPlus.CreateWnd to be a modal of another (Plus!) window?

In the first case, you can simply use the MessageBox function. You can easily find an example when searching these forums.

In the second case, you'll have to do it in a dirty way. That is, when you open your "modal" window, you disable your parent window with EnableWindow and re-enable it when you close it (in the OnWindowIdEvent_Destroyed event). I don't know if it's possible to set the focus to your modal window when you try to enable the parent window through a click or something, maybe you should experiment with that? :P


RE: RE: Active Dialog Window? by a0369 on 09-22-2008 at 05:44 PM

quote:
Originally posted by Mattike

In the second case, you'll have to do it in a dirty way. That is, when you open your "modal" window, you disable your parent window with EnableWindow and re-enable it when you close it (in the OnWindowIdEvent_Destroyed event). I don't know if it's possible to set the focus to your modal window when you try to enable the parent window through a click or something, maybe you should experiment with that? :P

That's what I'm currently doing for right now. It's the only thing I could think of to prevent the user from clicking the main window while a dialog box is open.
RE: Active Dialog Window? by a0369 on 09-22-2008 at 05:50 PM

there's only one tiny problem with disabling the main window while a dialog is open though. If that main window somehow goes on top of the dialog, then there is no way to get control back. Since the main window is disabled no messages get sent to it and it can't be closed.


RE: Active Dialog Window? by matty on 09-22-2008 at 06:01 PM

Why not hide the parent diaglog and show it on destroyed, this way you aren't creating a modal window but you can't do anything until afterwards.

Or make your "modal" window AlwaysOnTop


RE: Active Dialog Window? by Matti on 09-22-2008 at 06:02 PM

quote:
Originally posted by a0369
there's only one tiny problem with disabling the main window while a dialog is open though. If that main window somehow goes on top of the dialog, then there is no way to get control back. Since the main window is disabled no messages get sent to it and it can't be closed.
Well, yeah, that's the only point where it doesn't behave like a real modal window...
Someone with more creativity who might be able to find a workaround (or even better, a native way) to do this?
RE: Active Dialog Window? by matty on 09-22-2008 at 06:13 PM

Have a read it will explain a bit more why what you want to do doesn't natively exist: http://support.microsoft.com/kb/147817


RE: Active Dialog Window? by Matti on 09-22-2008 at 06:29 PM

quote:
Originally posted by matty
Have a read it will explain a bit more why what you want to do doesn't natively exist: http://support.microsoft.com/kb/147817
That's about a system-modal window. We're talking here about an application-modal window, which means that the user must complete the actions in the "modal" window first to go on in that application but it shouldn't block the user from doing things in other applications.
RE: Active Dialog Window? by matty on 09-22-2008 at 06:42 PM

Yes I am aware but there is no native function.

You can do this successfully with Window hooks and the enable window function and a bit of tweaking. But easiest way is to hide the parent and show it after the other has been destroyed.


RE: Active Dialog Window? by a0369 on 09-22-2008 at 09:32 PM

I think i'm going to have the main window be disabled when a dialog box comes up and have the dialog box set to always on top so that the main window will never become on top of it.