Defining Environment
Loaded the Delphi 10.1 starter promo edition. Have defined a Layout that contains a Rectangle component. The rectangle contains a label and another layout element. This second layout contains 2 labels. Looks like this:
lbl1 is aligned to the Top. Value1 is aligned to the Client. lblAnswer1 is aligned to the Client. lblPoints1 is aligned Right. On the labels, StyledSettings is set to nothing, i.e. all sub-options are False; Font size is set programmatically once when an INI file is read in. lbl1 is set for the full height of Answer1Rectangle so that Value1 is not shown as there is no remaining client area. To show the Value1 data I animate the height of lbl1, i.e. decrease the height of lbl1 to zero (0) which makes the Value1 layout grow in height as it is aligned to the client area of Answer1Rectangle. lblAnswer1 is aligned to Client. lblPoints1 is aligned to Right. lbl1 has it's HorzAlign property set to Center; lblAnswer1 has it's HorzAlign property set to Leading, i.e. Left Justified; lblPoints1 has it's HorzAlign property set to Trailing, i.e. Right Justified. All labels have their VertAlign properties set to Center. All alignment is set in the IDE not programmatically.
Problem
On startup lbl1 appears to be VertAlign Leading. When displaying the Value1 layout the font size is wrong, the alignment is wrong. Showing and hiding the Value1 element results in different results.
In the Starting state the "1" appears to be top aligned where the other numbers are correctly vertically centered.
Showing of the Value1 element shown in 1) has "Answer 11" in the font size that "99" should be. "99" is in the font size that "Answer 11" should be. "Answer 11" is right justified, i.e. Trailing, but it is programmed to be Leading. "99" is left justified, i.e. Leading, but it is programmed to be Trailing. Font sizes are programmatically set, the snippet is:
lblPoints1.TextSettings.Font.Size := AnswerValueFontSize;
Hiding the answer, 2), the "1" is now displayed Right Justified where it should be centred; the vertical alignment appears correct; the font size is now the size that "99" should be.
Showing the answer again, 3), shows "Answer 11" in the same incorrect state; "99" now shows correctly, i.e. font size and justification are correct.
Hiding the answer, 4), shows the "1" in the correct location, i.e. centered vertically and horizontally, and the font size has returned to the correct size.
Showing answer again, 5), puts us back into state 1).
Repeating showing and hiding simply repeats this pattern.
It needs to be pointed out that if the programme is re-compiled without any changes different, although equally wrong and inconsistent, results will be obtained, i.e. sometimes the pattern takes longer before it repeats. Also, other questions may display their solutions correctly on a consistent basis.
Any ideas as to why this is happening would be greatly appreciated.
Thanks for everyone's time.