Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TButton FontSize and horizontal alignment
Tue, Sep 20 2016 9:15 AMPermanent Link

Michael Dreher

In the IDE I've changed the FontSize in a TButton from the default value 16 to 12 and reduced the button width. The caption text appears centered (see (2) in screenshot) as expected. When running the application in a browser, or after reloading the project in der IDE the caption text is not any more centered. In fact, the first letters aren't readable  (see (3) ).

Do I have to make additional changes in the TButton interface for a different font size?

Michael Dreher



Attachments: ButtonScreenShots.zip
Wed, Sep 21 2016 6:17 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< In the IDE I've changed the FontSize in a TButton from the default value 16 to 12 and reduced the button width. The caption text appears centered (see (2) in screenshot) as expected. When running the application in a browser, or after reloading the project in der IDE the caption text is not any more centered. In fact, the first letters aren't readable  (see (3) ).

Do I have to make additional changes in the TButton interface for a different font size? >>

Did you make the control interface changes *prior* to 2.05, or using the 2.05 control interfaces ?

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Sep 21 2016 8:10 AMPermanent Link

Michael Dreher

Tim Young [Elevate Software] wrote:

 // Did you make the control interface changes *prior* to 2.05, or using the 2.05 control interfaces ?

I changed the Font/Size property of the TButton control to 12. The Font/Size property of the Caption element in the TButton control interface is not modified.

Michael Dreher
Thu, Sep 22 2016 12:13 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< I changed the Font/Size property of the TButton control to 12. The Font/Size property of the Caption element in the TButton control interface is not modified. >>

What happens if you cut the button in the designer, and paste it back into the designer ?  Does it reset the caption so that it fits ?

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Sep 22 2016 12:15 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

Never mind, I've got it - it's not updating the layout when the width of the button changes.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Sep 22 2016 12:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

Okay, here's the hot fix:

Add this protected method to the TButtonControl class in the WebBtns unit:

procedure TButtonControl.ElementChanged(AChange: Integer; AElement: TElement);
begin
  if (AChange=ecFontChanged) and (AElement=FCaptionElement) then
     UpdateLayout
  else
     inherited ElementChanged(AChange,AElement);
end;

This fix will be in 2.05 B5.

Tim Young
Elevate Software
www.elevatesoft.com
Image