Article View: comp.lang.pascal.delphi.components.misc
Article #23Re: TForm inside a TThread
From: Sterling Bates
Date: Fri, 06 Jul 2001 17:18
Date: Fri, 06 Jul 2001 17:18
55 lines
3260 bytes
3260 bytes
The TList is exactly how I went about it. Thanks to you and Bruce for your
help.
"Sundial Services" <info_NS1@sundialservices.com> wrote in message
news:3B45F003.2FA5@sundialservices.com...
> An application can have as many windows open as it wishes; including, if
> you like, multiple copies of the same form. (You simply must be sure
> that you keep each TForm object separate from the others, e.g. in a
> TList. You can't use Delphi's standard trick of creating a global
> variable to hold it.)
>
> Intrinsically, a form .. any Windows window .. is dependent upon the
> Windows software to draw and maintain it, and this occurs through the
> use of Windows messages. Only one thread (the main thread) should be
> having anything to do with Windows messages. It can, however, support
> any number of windows at the same time. (All the messages for all the
> windows flow through it.)
>
>
>
>
> >Sterling Bates wrote:
> >
> > I'm use several TThreads to spawn instances of the same form multiple
times;
> > ie:
> >
> > procedure TSpawnFormThread.Execute;
> > begin
> > FreeOnTerminate := true;
> > with TMyForm.Create(nil) do
> > begin
> > ShowModal;
> > Release;
> > end;
> > end;
> >
> > This tends to create interesting errors (window handle no longer valid)
on
> > the Release of the form, and the message "Canvas does not allow drawing"
> > when activating a form (this primarly caused, it seems, by TRichEdit).
> >
> > Another poster mentioned that only the main VCL thread properly handles
> > forms, but need to know if there's an elegant way to work with this.
> >
> > Note: I *do* need to pop up multiple instances of the same form -- I'm
open
> > to suggestions on other ideas.
>
> ------------------------------------------------------------------
> Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
> mailto:info@sundialservices.com (PGP public key available.)
> > Fast(!), automatic table-repair with two clicks of the mouse!
> > ChimneySweep(R): "Click click, it's fixed!" {tm}
> > http://www.sundialservices.com/products/chimneysweep
Technical Details
Message-ID:
<4qm17.12298$E93.2260607@news1.telusplanet.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.telusplanet.net!news1.telusplanet.net.POSTED!not-for-mailReferences:
<T1d17.12112$E93.2145422@news1.telusplanet.net> <3B45F003.2FA5@sundialservices.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1091e5,4265b72517a20f0e X-Google-Attributes: gid1091e5,public X-Google-Thread: 109d99,4265b72517a20f0e X-Google-Attributes: gid109d99,public X-Google-ArrivalTime: 2001-07-06 10:20:06 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.telusplanet.net!news1.telusplanet.net.POSTED!not-for-mail From: "Sterling Bates" <noone@nowhere.com> Newsgroups: comp.lang.pascal.delphi.components.misc,borland.public.delphi.winapi References: <T1d17.12112$E93.2145422@news1.telusplanet.net> <3B45F003.2FA5@sundialservices.com> Subject: Re: TForm inside a TThread Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2462.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000 Message-ID: <4qm17.12298$E93.2260607@news1.telusplanet.net> Date: Fri, 06 Jul 2001 17:18:56 GMT NNTP-Posting-Host: 161.184.191.228 X-Trace: news1.telusplanet.net 994439936 161.184.191.228 (Fri, 06 Jul 2001 11:18:56 MDT) NNTP-Posting-Date: Fri, 06 Jul 2001 11:18:56 MDT