Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS FMX UI Pack
TTMSFMXButton: How to set the text alignment
TTMSFMXButton: How to set the text alignment
Many users try to set the text alignment via the TextAlign property. The TextAlign property does not apply to the text string, but to the text control. You can notice this as the property isn''t a TTextAlign property but a TAlignLayout property.
You can use the following code to left-align the text. The OnApplyStyleLookup event can be used to access the image and text object that are used inside the TTMSFMXButton:
procedure TForm1.TMSFMXButton1ApplyStyleLookup(Sender: TObject); begin TMSFMXButton1.HTMLText.HorzTextAlign := TTextAlign.Leading; end;
You can also shift the text object with the margins property (if the text object is client aligned):
procedure TForm1.TMSFMXButton1ApplyStyleLookup(Sender: TObject); begin TMSFMXButton1.HTMLText.HorzTextAlign := TTextAlign.Leading; TMSFMXButton1.HTMLText.Margins.Left := 5; end;