Article View: comp.lang.pascal.delphi.components.misc
Article #25Re: TForm inside a TThread
From: Bruce Roberts
Date: Fri, 06 Jul 2001 08:03
Date: Fri, 06 Jul 2001 08:03
25 lines
2189 bytes
2189 bytes
"Sterling Bates" <noone@nowhere.com> wrote in message news:T1d17.12112$E93.2145422@news1.telusplanet.net... > I'm use several TThreads to spawn instances of the same form multiple times; > 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. The VCL is not thread safe. What you are trying to do will simply not work. But you don't need threads to do what you want. Instead set Action to caFree in the form's OnClose and use the following code like the following (shows 2 copies of the same form) tMyForm.Create (Application).Show; tMyForm.Create (Application).Show;
Technical Details
Message-ID:
<6ke17.42816$TW.214295@tor-nn1.netcom.ca>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!tor-nx1.netcom.ca!tor-nn1.netcom.ca.POSTED!not-for-mailReferences:
<T1d17.12112$E93.2145422@news1.telusplanet.net>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 01:06:33 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!tor-nx1.netcom.ca!tor-nn1.netcom.ca.POSTED!not-for-mail From: "Bruce Roberts" <ber@bounceitattcanada.xnet> Newsgroups: comp.lang.pascal.delphi.components.misc,borland.public.delphi.winapi References: <T1d17.12112$E93.2145422@news1.telusplanet.net> Subject: Re: TForm inside a TThread Lines: 28 Organization: Roberts Browne Limited X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: <6ke17.42816$TW.214295@tor-nn1.netcom.ca> Date: Fri, 6 Jul 2001 04:03:56 -0400 NNTP-Posting-Host: 142.194.184.51 X-Complaints-To: abuse@attcanada.ca X-Trace: tor-nn1.netcom.ca 994406786 142.194.184.51 (Fri, 06 Jul 2001 04:06:26 EDT) NNTP-Posting-Date: Fri, 06 Jul 2001 04:06:26 EDT