all other options are default ones.So, the labels have AutoSize=true? Then there is no way to distinguish left-aligned, centered and right-aligned single-line labels because the size of the label is adjusted such that it tightly encloses the text. I don't understand...
open, focus on first tab, run and watch alignment of labels... first column is left, center is center, right is right.
then change tab and watch missaligned.
Then click on the button below and change tab and do it several tabs...
now i find that labels moves far from their design position.
if you stop, focus on second tab and run.
second tab is as should be with alignment but first not...
play again with button and changin tabs and you will see
New version of the project.
i've added checks to use as guide for the alignment
you can see that right alignment is not working as expected (or at least i think they should be)
the numbers NOT align to the right (encolumned (dont know if its the right term))
in runtime If you change the tabs and press the button and change the tab again they move more!!
I see. I must confess that I had never realized that a label which has an anchor akLeft but Alignment taRightJustify keeps its right edge fixed when the Caption is changed. Almost sounds like a bug, but I checked with Delphi, and it shows that same unlogical behaviour.
But this is just what I am saying: The anchor akLeft holds it fixed at the left, thus the balloon should grow to the right. This behaviour also contradicts other controls: A TStaticText with Alignment=taRightJustify, AutoSize=true and akLeft in Anchors grows to the right with the Caption. Or TCheckbox/TRadioButton always grows to the right, too - its default Alignment is taRightJustify.I see. I must confess that I had never realized that a label which has an anchor akLeft but Alignment taRightJustify keeps its right edge fixed when the Caption is changed. Almost sounds like a bug, but I checked with Delphi, and it shows that same unlogical behaviour.
Seems logical to me. It's like inflating a balloon... it expands and contracts on the end that is not being held in place.
I see. I must confess that I had never realized that a label which has an anchor akLeft but Alignment taRightJustify keeps its right edge fixed when the Caption is changed. Almost sounds like a bug, but I checked with Delphi, and it shows that same unlogical behaviour.
Anyway, if you want a label to be right-aligned and keep its right edge fixed then you should set its akRight anchor, as dsiders already said. And I would even go a step further an use the anchor editor to anchor the right edge of the label to a fixed point, e.g. the right edge of the parent.
I am attaching a modified version of your first project in which the left labels are anchored to the left side of the tabsheet, the center labels are anchored to the center of the tabsheet, and the right labels are anchored to the right sides of the tabsheet. I also painted the background in yellow to exactly see the position of the labels.
I see. I must confess that I had never realized that a label which has an anchor akLeft but Alignment taRightJustify keeps its right edge fixed when the Caption is changed. Almost sounds like a bug, but I checked with Delphi, and it shows that same unlogical behaviour.
Anyway, if you want a label to be right-aligned and keep its right edge fixed then you should set its akRight anchor, as dsiders already said. And I would even go a step further an use the anchor editor to anchor the right edge of the label to a fixed point, e.g. the right edge of the parent.
I am attaching a modified version of your first project in which the left labels are anchored to the left side of the tabsheet, the center labels are anchored to the center of the tabsheet, and the right labels are anchored to the right sides of the tabsheet. I also painted the background in yellow to exactly see the position of the labels.
thanks! it sound logical to me that if i put a label and i chose right alignment it would align to the rightest side of the label but then again, is confusing. The very rare thing is that when it happens inside a ttab, in the active tab when i compile it and run, appears ok and on the other tabs don't. That is what puzzles me. Then again, stop program, set index to tab 2 and compile again, the tab two aligns as expected but the one is left aligned. That's why i think its a bug
I never used anchors and border spacing but in the example you gave me is working as expected so i will implement it that way next time.
Thank you all!
I see. I must confess that I had never realized that a label which has an anchor akLeft but Alignment taRightJustify keeps its right edge fixed when the Caption is changed. Almost sounds like a bug, but I checked with Delphi, and it shows that same unlogical behaviour.
Anyway, if you want a label to be right-aligned and keep its right edge fixed then you should set its akRight anchor, as dsiders already said. And I would even go a step further an use the anchor editor to anchor the right edge of the label to a fixed point, e.g. the right edge of the parent.
I am attaching a modified version of your first project in which the left labels are anchored to the left side of the tabsheet, the center labels are anchored to the center of the tabsheet, and the right labels are anchored to the right sides of the tabsheet. I also painted the background in yellow to exactly see the position of the labels.
thanks! it sound logical to me that if i put a label and i chose right alignment it would align to the rightest side of the label but then again, is confusing. The very rare thing is that when it happens inside a ttab, in the active tab when i compile it and run, appears ok and on the other tabs don't. That is what puzzles me. Then again, stop program, set index to tab 2 and compile again, the tab two aligns as expected but the one is left aligned. That's why i think its a bug
I never used anchors and border spacing but in the example you gave me is working as expected so i will implement it that way next time.
Thank you all!
Then you did not learn anything from this discussion. It has nothing to do with TPageControl... and everything to do with a random number of digits being stuffed into an auto-sized label. But never mind... you have your solution. Copy and paste. We can all move on now.
whatever he did it didn't solve anything from what I can see, it still fails.No, he fixed the first level of visibility (Label.Visible = false).
... but he met serious difficulties when extending the fix into the LCL (all parents of the label must be visible!), and in the end the changes would be too massive and risky so that he decided to revert the related changes and document them as Delphi-incompatibility issues:whatever he did it didn't solve anything from what I can see, it still fails.No, he fixed the first level of visibility (Label.Visible = false).