in Education by
I got some code here, which creates a label just fine, but when I free the label it STILL shows on the form. Even though it's been removed and no longer 'assigned'. Here is the code below. It creates the label fine, but wont remove. No exceptions, and the assigned says false. I can reproduce this with a TRectangle as well. type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } Lab : TLabel; end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.Button1Click(Sender: TObject); begin Lab := TLabel.Create(Self); Lab.Parent := Form1; Lab.Text := 'Hello!'; Lab.Position.X := 30; Lab.Position.Y := 40; end; procedure TForm1.Button2Click(Sender: TObject); begin FreeAndNil(Lab); ShowMessage(BoolToStr(Assigned(Lab), true)); end; JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
i think Lab.Parent:= NIL; FreeAndNil(Lab); could help.

Related questions

0 votes
    I got some code here, which creates a label just fine, but when I free the label it STILL shows ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    To remove a transition form a slide , click on none options in transition to this slide group on…… Tab in PowerPoint Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    I currently have a UIView, call it (A), that is outsourced out into a 3rd party library. Pressing ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I'm trying to take the text from a ttk label and assign it to a variable, but I don't actually ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I'm trying to take the text from a ttk label and assign it to a variable, but I don't actually ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I have inherited a large legacy ColdFusion app. There are hundreds of some sql here #variable# statements ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    In my application, I'm displaying a Power BI report. It already works, so there's no problem with showing ... dataset in the report? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I found the following piece of code from the adw launcher: Object service = launcher.getSystemService("statusbar ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    I'm going to be getting an array of objects and want to set instance variables inside of a class ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    Which of the following function programmatically extract parts of XML file? (a) XmlSApply (b) XmlApply (c) ... and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    How to get the Jenkins version programmatically in Jobs/Pipelines or nodes other than master?...
asked Sep 14, 2021 in Technology by JackTerrance
0 votes
    How Jenkins jobs can be Triggered/Stopped/Controlled programmatically?...
asked Sep 14, 2021 in Technology by JackTerrance
0 votes
    How to access a variable name programmatically?...
asked Jul 29, 2021 in Technology by JackTerrance
...