[Lazarus] Measuring text width in a TEdit
Vojtěch Čihák
vojtech.cihak at atlas.cz
Tue May 30 14:02:28 CEST 2017
Hi,
maybe you can create some temporary canvas, assign TEdit.Font to TCanvas.Font, do the measurement and free that canvas.
V.
______________________________________________________________
> Od: Torsten Bonde Christiansen via Lazarus <lazarus at lists.lazarus-ide.org>
> Komu: Lazarus mailing list <lazarus at lists.lazarus-ide.org>
> Datum: 30.05.2017 08:36
> Předmět: [Lazarus] Measuring text width in a TEdit
>
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. :)
Kind regards,
Torsten Bonde Christiansen.
--
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus <http://lists.lazarus-ide.org/listinfo/lazarus>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170530/7ff6484e/attachment.html>
More information about the Lazarus
mailing list