TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Johan Siegers
from: Toby Potts
date: 1994-12-19 08:58:30
subject: Message Box Focus - Modeless Dialogs

Thanks for the reply, its been tough to get one. I think maybe my
explanation was not very clear.  The problem arises because I have been
directed to use modeless dialogs where modal dialogs would probably work
better.

I use WinLoadDlg to create my dialog.  I can have any number of modeless
dialogs "up" at one time when running the application.  If the
user decides to change focus from the dialog currently in focus to any one
of those dialogs in the background (or the toolbar/menubar), I need to
prompt them with a message box to Save the current dialog if any data has
changed since the last save.

You can see that the only way I really know when to prompt the user to save
is if my dialog is losing the focus (or another is gaining the focus). This
is the real problem because when you are in the middle of changing focus
from one dialog to another, I'm not sure you can "GET" the focus
needed to display a message box.  At least this seems to be the way
modeless dialogs work together.

I tried using the WM_ACTIVATE message because the dialog losing focus AND
the dialog gaining the focus receive this message. If usactive == FALSE
(the dialog is losing the focus) I try to display the message box.  It
doesn't have focus nor will it take focus.

Next I tried using the WM_FOCUSCHANGE message, but anytime you change focus
to any window(even other controls on the same dialog like entryfields,
radio buttons, check boxes, push buttons, etc...) you receive this message.
This is a lot of work to ensure I only display my message box for
"Dialog" focus changes and not all the other control focus
changes. Also, the message box still did not have focus nor would it take
focus.

Last, I tried using the WM_BUTTON1DOWN message, and my message box DID have
focus.  I thought to myself GREAT, but little did I realize that each
individual control on a dialog responds independently to this.  Therefore,
if the user "clicked" on anything other than empty space on a
dialog, the message wasn't received at the dialog level.  The individual
control received the message.  I would have to subclass all controls on all
dialogs to respond to this message.  Not exactly what I had in mind.

I really believe using modal dialogs would solve the problem, but I don't
have that as an option.  Again, thanks for your response. I'm working on
code from another response that indicated using flags may help. Does that
spark any ideas?  Thanks...Toby  

--- Maximus/2 2.02
* Origin: PMSC OnLine Resource - Columbia, SC - (1:376/32)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1
@PATH: 376/32 3641/1 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.