[Lazarus] Measuring text width in a TEdit
zeljko
zeljko at holobit.net
Tue May 30 16:04:23 CEST 2017
On 30.05.2017 08:36, Torsten Bonde Christiansen via Lazarus wrote:
> Hi List.
>
> I want to know the placement of the caret (in pixels, not character
> count) in a TEdit. However i am struggeling to fint a method that will
> allow me to do so.
>
> If i try to calculate it using the assigned font, I have the problem
> that TEdit.Font.GetTextWidth always returns the default size (16), since
> the Font doesn't have a canvas assigned to it.
>
> The TEdit itself does not really have any methods for calculation the
> caret position in pixels either.
>
> All suggestions are welcome. :)
I'm using TBitmap which assigns TEdit.Font for such cases.Measurement is
correct.
zeljko
More information about the Lazarus
mailing list