Recent

Author Topic: TLEDNumber text alignment - industrialstuff component  (Read 2999 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
TLEDNumber text alignment - industrialstuff component
« on: April 16, 2014, 03:46:48 pm »
So, I am using IndustrialStuff component. More specifically I am using TLEDNumber tool to display text looking like a face of a digital clock. Everything is great with this component. However, I would like to set my text alignment to the center. Apparently, there seems to be no published property for me to be able to do that. By default, the text or caption is aligned to the left.

Does anyone know how to align text with TLEDnumber tool? thanks,

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: TLEDNumber text alignment - industrialstuff component
« Reply #1 on: April 16, 2014, 04:37:25 pm »
A brief look at the source does not offer much hope. It is not designed for extensibility: none of the added protected methods is virtual (so cannot be overridden); and several display offset assignments use hard-coded values.
Perhaps Jurassic Pork, who adapted the code for Lazarus, will have a suggestion?

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: TLEDNumber text alignment - industrialstuff component
« Reply #2 on: April 16, 2014, 05:29:46 pm »
What is the problem padding the text with spaces before passing it to the control? There are functions "PadLeft", "PadRight" and "PadCenter" in StrUtils.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLEDNumber text alignment - industrialstuff component
« Reply #3 on: April 16, 2014, 05:56:03 pm »
i agree with wp, use padding to center the text.

Why do you want to center the text ?  to have black array at right and left ?

why not autoadjust the number of columns of the control with the number of text characters ?
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 451
  • Programming is FUN only when it works :)
    • Cool Technology
Re: TLEDNumber text alignment - industrialstuff component
« Reply #4 on: April 16, 2014, 08:10:08 pm »
i agree with wp, use padding to center the text.

Why do you want to center the text ?  to have black array at right and left ?

why not autoadjust the number of columns of the control with the number of text characters ?

Yes, if the text is centered, it will look really nice.

 

TinyPortal © 2005-2018