Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 2 of 2 total |
Using Free in With frees main form instead of object |
Thu, May 24 2012 12:01 AM | Permanent Link |
Rick | Tim
Consider the following example code: procedure TForm1.Button1Click(Sender: TObject); begin with TPanel.Create(Self) do begin Width:=100; Height:=100; Free; end; end; I expected the Free to apply to the newly created TPanel via the "with" but it seems to free the main form when the application starts. The main form isn't even displayed and there is no chance to click the button. It doesn't matter if the "with" object is newly created or pre-existing. -- Rick |
Tue, Jul 3 2012 3:05 PM | Permanent Link |
Rick | "Rick" <NOSPAMradwal@NOSPAMncable.net.au> wrote in message
news:5F251E43-8898-4A83-9A12-2E2210C455A7@news.elevatesoft.com... > procedure TForm1.Button1Click(Sender: TObject); > begin > with TPanel.Create(Self) do > begin > Width:=100; > Height:=100; > Free; > end; > end; > > I expected the Free to apply to the newly created TPanel via the "with" > but it seems to free the main form when the application starts. The main > form isn't even displayed and there is no chance to click the button. > > It doesn't matter if the "with" object is newly created or pre-existing. > > The July 3 build gives a compile time error if using Free in With for a newly created object. It requires an instance variable to work properly. This is better than a blank screen when the application starts. Free in With is also working correctly for pre-existing objects. Problem solved, thanks. -- Rick |
This web page was last updated on Tuesday, April 23, 2024 at 08:10 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |