[Lazarus] How many characters fit in a TEdit?
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Mon Sep 30 20:46:45 CEST 2013
Bart schrieb:
> Is it possible to determine how many characters fit in a TEdit (at
> runtime), given that the choosen font is of fixed pitch (like
> Courier).
> Example:
> TEdit: Width = 300
> Font; Courier New, Size=16
>
> TEdit.GetTextWidth() does not help here, it returns 16 for any font
> and size (because we cannot access the canvas).
You can use it in your edit.OnPaint handler, where you also can scroll
the text. Eventually use an TLabel instead of TEdit, with better display
control.
DoDi
More information about the Lazarus
mailing list