1. Re: Locked (modal?) "simulated" dialogs
- Posted by Jacques Deschenes <desja at GLOBETROTTER.QC.CA>
Jun 06, 1998
-
Last edited Jun 07, 1998
At 11:07 06-06-98 -0700, you wrote:
>Hi Michael & Irv,
>
>[Michael]
>
>That's what I thought, too. I've been attempting to get that approach for
>the last week or so. The illusion isn't perfect. For example, if you attempt
>to focus on a "unfocusable" window, the focus returns to the "modal"
>window - but not before the title bar changes to the focus color - and I end
>up with two windows with "active" title bars. So I'm not catching the event
>at a high enough level yet.
>
>[Irv]
>
>I'm trying to avoid "real" dialogs, since Win32Lib supports (or will
>support) all the stuff that you get with dialogs anyway. I was looking for a
>flag or function call that would declare a "normal" window to be modal.
>After all, you could do that sort of thing in VB, so I assumed that it was
>something that Win32 supported automatically.
>
>But that appears not to be the case - only dialogs are allowed to be modal.
>So I'm trying to see if I can simulate modality by locking a "normal"
>window. My approach thus far has been to prevent other windows controlled by
>Win32 from gaining focus. But as I mentioned to Michael, when I catch an
>OnFocus, I'm catching the event *after* the other window has already gained
>focus. So I need to capture the event *before* the window can accept the
>focus, and re-route it to the "modal" window.
>
>I'm not sure what event that is, and where to catch it. But I'm fairly sure
>that's how VB did the trick, since there are no "modal" flags that I can get
>with a "normal" window. They make the window *look* modal - but you can
>still set focus on other windows.
>
>Of course, I could easily be going about this the wrong way. If anyone has a
>suggestion, I'm open to it.
>
>-- David "cooling his jets
" Cuny
>
David I'm doubtfull about the assertion that only dialogs can be modal. I think
that every windows are create using CreateWindowEx() and others function like
MessageBox() or CreateDialog are only higher level functions that calls
CreateWindowEx(). As I suggested earlier if I was you I would try DS_SYSMODAL
flag for window style even if it begin with DS_ it doesn't mean that would not be
valid in a CreatWindowEx() call. After all CreateDialog use WS_ constants in
it's style
parameter why not the opposite.
IMHO there is no difference between a dialog and a normal windows as much as
creation is concern. I make a guess that the modality is a question of style.
Well I didn't take the time to test it but I bet my dollar of the month on it :)
Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at globetrotter.qc.ca