🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15669

Modal Form Fun not

#15669
From: Colin
Date: Fri, 20 Jun 2003 06:30
28 lines
2485 bytes
My problem concerns modal forms that overlay the main app, such as a
dialog or similar. If the user uses the task bar or task list to shell
to a different app (momentarily or for an extended time) and then shells
back to my app, the main form loads in front of the modal dialog, but it
doesn't have focus so all it's controls are deactivated. The frustration
is trying to get the modal form to again appear in front of the main
form so that it can receive it's usual input.

The problem is mainly to do with the use of the app icon on the task
bar. If AltTab is used then the modal form does load in front of the
main form, but when the task bar icon is used, then the main form loads
in front of the modal form.

Anybody encountered this problem and have a neat solution? (I suppose I
could make my dialogs SYSTEMMODAL, but that wouldn't make the user happy
if my form was stuck in front of the app he had shelled to).

I've tried trapping the Application->OnRestore and
Application->OnActivate events and coded a means to find the active &
visible form and then call SetForegroundWindow on that form's handle,
but when the problem occurs, neither handler is called so my coed
doesn't help me. I've tried trapping the Windows messages that arise
when the task bar icon is clicked, but the same message (WM_ACTIVATE)
arises in a myriad of other ways without sufficient discriminating
information to tie it to the task icon so that I can call my handler, so
now I'm a bit stuck.

(BTW - I'm using BCB5Ent with all sp's on a Pent4 with W2Ksp3)
Technical Details
Message-ID: <3EF2A9F1.1F93B6F@ValidEmail.Address>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7b2f772e02323164,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-20 00:10:14 PST
Message-ID: <3EF2A9F1.1F93B6F@ValidEmail.Address>
Date: Fri, 20 Jun 2003 08:30:09 +0200
From: Colin <ThisIsNot@ValidEmail.Address>
X-Mailer: Mozilla 4.51 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Modal Form Fun not
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 196.15.174.130
X-Trace: newsgroups.borland.com 1056090611 196.15.174.130 (19 Jun 2003 23:30:11 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail