Delphi: Dynamically created Label remains invisible
Question by Guest | 2013-10-21 at 21:43
On the Internet, I found a tutorial allowing me creating labels dynamically at runtime. I have tried to use the code in one of my applications, but for whatever reason, I cannot see my Label on the Form.
By now, I am using the following code so far:
with TLabel.Create(self) do begin name:='label1'; left:=8; right:=8; caption:='My Label'; visible:=true; end;
As you can see, I have especially set the property "Visible" to true, but also this does not make the Label appearing on my Form.
What am I doing wrong? Can anyone help me?
Related Topics
Delphi/Lazarus: Dynamically create a Label at runtime
Tip | 0 Comments
Delphi/Lazarus: How to set up a Link to a Website in an Application
Tutorial | 0 Comments
Delphi/Lazarus: Create TabSheet on PageControl dynamically
Tutorial | 0 Comments
Delphi: Multiline Caption for TLabel (at Run Time and Design Time)
Tutorial | 1 Comment
HTML Form: Redirection depending on Radiobutton or Checkbox State
Tutorial | 0 Comments
PHP: Submit Form with many Checkboxes to Script comfortably
Tip | 2 Comments
jQuery: Toggle Checkboxes (Select/Unselect All)
Tip | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You forgot to specify the property "Parent" for your label.
Please try to add the following line to your code where Form1 is the Form on which the label should appear:
This property determines to which other control your label is assigned. If the property is empty, your label is floating somewhere in the vacuum.
If your label should appear on your Form, you need to set this as a parent.
2013-10-22 at 12:03