"Google" and "Search" are your friends :)
As you're climbing the learning curve, I'd suggest sticking with TLabel. I can remember only one time when I needed TStaticText, and it's been so long ago that I don't remember the circumstance. (Lazarus is such a rich programming environment that you'll often have multiple ways of accomplishing things, with sometimes subtle differences in how they work. Because I'm old, I have devolved into picking one alternative and sticking with it, brain cells being at a premium anymore.)
The wiki has the information about them:
https://wiki.freepascal.org/TLabel (https://wiki.freepascal.org/TLabel)
https://wiki.freepascal.org/TStaticText (https://wiki.freepascal.org/TStaticText)
If after reading the wiki still have no idea, you haven't really read it. It mentions TGraphicControl and TWinControl. What are the differences? Keep reading. All the information you need is already documented. Sooner or later, you will find it. :D
As already suggested, for beginners ... stick with TLabel.
More memory saving TStaticText, more flexible TLabel. More speed, you will feel no difference I guess. TLabel can scale with DPI, about TStaticText I am unaware.
and since it has a window handle, external programs can scan your app and get the info! :D
... I need all that kind of info. Reference docs don't give that info.
It supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls. Since lightweight controls do not wrap GUI widgets, they use fewer resources than controls based on TWinControl.Source: https://wiki.freepascal.org/TGraphicControl (https://wiki.freepascal.org/TGraphicControl)
TGraphicControl provides a Canvas property for access to the control's drawing surface and a virtual Paint method and an OnPaint handler, called in response to paint requests received by the parent control.
Override the Paint method or supply your own OnPaint handler, to do the actual drawing of the control.
More memory saving TStaticText, more flexible TLabel.
More memory saving TStaticText, more flexible TLabel.
Are you sure?On Windows, yes.
Can you prove it?On Windows, yes. See Attachment.
The documentation says differently.I did not wrote.
If you put TStaticLabel over TImage then this label's transparency won't work properly and it will have a solid background.
TLabel will have a proper transparent background.
You can put TStaticLabel over TPanel but TLabel will always be behind TPanel.
If you put TStaticLabel over TImage then this label's transparency won't work properly and it will have a solid background.
TLabel will have a proper transparent background.
You can put TStaticLabel over TPanel but TLabel will always be behind TPanel.
It's TStaticText and not TStaticLabel.
I'm using Windows, and both allow transparency and display just fine over an image. Both display just fine on a Panel... even on top of an image on a panel.
If you use the "search" capability of the forum here, you will find years of experience regarding the use of things like statictext and label. And Google will expand that knowledge base further in just about every case. But...
As a teacher, I'd encourage you to prioritize functionality rather than optimization at this point on your way up the learning curve. You'll make faster progress toward real proficiency, and have more fun along the way, by making things work first. It's like writing a good paper: get your first draft down on paper -- then revise and refine. Different people have different learning styles of course, but that's the one that seems the best fit to a majority of us in my experience.
Both display just fine on a Panel... even on top of an image on a panel.Not "on" TPanel, but "over". Like on my screenshot and then try to bring TLabel to front- you can't.
What's the difference with these two boxes?I'm going to answer your question from a Windows API point of view.
Under what circumstances do I need to use a TLabel?
Under what circumstances do I need to use a TStaticText?
When choosing, what do I need to ask myself in order to make the right decision and place the correct control?
You can put TStaticLabel over TPanel but TLabel will always be behind TPanel.
That is incorrect, you an put a TLabel on top of a TPanel just fine.Not on top, you can put it inside a tpanel just fine. On top assumes the same parent, at least in my book.
That is incorrect, you an put a TLabel on top of a TPanel just fine.Not on top, you can put it inside a tpanel just fine. On top assumes the same parent, at least in my book.
That's not on top, that's panel transparency of sorts. The tlabel is bellow the tpanel.That is incorrect, you an put a TLabel on top of a TPanel just fine.Not on top, you can put it inside a tpanel just fine. On top assumes the same parent, at least in my book.
You can, if Tpanel property ParentColor is True, as you can see in Reply #21.
That's not on top, that's panel transparency of sorts. The tlabel is bellow the tpanel.That is incorrect, you an put a TLabel on top of a TPanel just fine.Not on top, you can put it inside a tpanel just fine. On top assumes the same parent, at least in my book.
You can, if Tpanel property ParentColor is True, as you can see in Reply #21.
What do you mean by "on top" and "below"? I guess now that you mean Z-order "Front"/"Forward" and "Back", not what you see on the screen. In this case I agree with you, Z-order does not affect the behaviour of TLabel.Yes with "on top" and "bellow" I'm talking about the z order and no its not the same, which is evident by the frame line on top of the tlabel in your screenshot.
But you confused me with your terminology. %) For me Label is "on top" at the first picture, and "below" at the second.
What do you mean by "on top" and "below"? I guess now that you mean Z-order "Front"/"Forward" and "Back", not what you see on the screen. In this case I agree with you, Z-order does not affect the behaviour of TLabel.Yes with "on top" and "bellow" I'm talking about the z order and no its not the same, which is evident by the frame line on top of the tlabel in your screenshot.
But you confused me with your terminology. %) For me Label is "on top" at the first picture, and "below" at the second.
What do you mean by "on top" and "below"? I guess now that you mean Z-order "Front"/"Forward" and "Back", not what you see on the screen. In this case I agree with you, Z-order does not affect the behaviour of TLabel.Yes with "on top" and "bellow" I'm talking about the z order and no its not the same, which is evident by the frame line on top of the tlabel in your screenshot.
But you confused me with your terminology. %) For me Label is "on top" at the first picture, and "below" at the second.
I don't understand what do you mean again. What is "not the same"? I changed Z-order of Label1 regarding Panel1 in all ways, and the picture is the same.
is not the same.
tlabel is drawn on the canvas of the parent control. tstatictext has his own canvas than can be placed half in the form and half in the tpanel...
I don't understand what do you mean again. What is "not the same"? I changed Z-order of Label1 regarding Panel1 in all ways, and the picture is the same.The picture is the same because changing z-order doesn't work for TLabel. It's always behind TPanel.
I don't understand what do you mean again. What is "not the same"? I changed Z-order of Label1 regarding Panel1 in all ways, and the picture is the same.The picture is the same because changing z-order doesn't work for TLabel. It's always behind TPanel.
Zoom the image see the white line on top of the tlabel and bellow the tstatictext. Transparent tpanel and on top of the tpanel is not the same.I don't understand what do you mean again. What is "not the same"? I changed Z-order of Label1 regarding Panel1 in all ways, and the picture is the same.The picture is the same because changing z-order doesn't work for TLabel. It's always behind TPanel.
That's what I have written. I have not understood, what is "not the same".
Zoom the image see the white line on top of the tlabel and bellow the tstatictext. Transparent tpanel and on top of the tpanel is not the same.I don't understand what do you mean again. What is "not the same"? I changed Z-order of Label1 regarding Panel1 in all ways, and the picture is the same.The picture is the same because changing z-order doesn't work for TLabel. It's always behind TPanel.
That's what I have written. I have not understood, what is "not the same".
i do not understand your strange discussion.your image makes my point. Observe the white line on top of tlabel and read my messages again.
whoever told first that a tlabel is always behind a tpanel is wrong - at least on windows
but probably i misunderstood something
And correct your post, please, as it looks like I wrote your words.
what has it to do with topic "TLabel or TStaticText" ?