How to Set the Length of a String

Posted December 15th @ 7:01 pm by m3Rlin

The string length is automatically set but sometimes you want to change the length yourself. That’s because sometimes you have to have the same length of a string every time (when saving to binary files). You can always use the string[n] (ShortString) type but their maximum length is 256 characters.
!!Note: You CAN NOT set the [...]

How to Get a String’s Width in Pixels, Not in Characters

Posted December 15th @ 7:27 am by m3Rlin

To determine the width of a string in pixels using the active font and output it’s best to use this method:

(* sString - (string) Can be any string constant or variable.
**
** For example:
** TCanvas.TextWidth(’m3Rlin’);
** TCanvas.TextWidth(Edit1.Text);
** TCanvas.TextWidth(OpenDialog1.FileName);
[...]