![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Fri, May 19 2017 8:27 AM | Permanent Link |
thomh | Is it possible to calculate this?
I have a TEdit with Width = 400 and Font size = 12 I have AString whose length is 250 chars How would I calculate how many chars of AString I can visibly fit into the TEdit control based on its Width property? So TEdit.Text := Copy(AString, 1, XXX); Thanks. // Thom |
Fri, May 19 2017 9:04 AM | Permanent Link |
Matthew Jones | thomh wrote:
> How would I calculate how many chars of AString I can visibly fit into the TEdit control based on its Width property? It all starts with this: nWidth := InterfaceManager.ContentWidth(editText.Font, AString); -- Matthew Jones |
Fri, May 19 2017 10:20 AM | Permanent Link |
thomh | "Matthew Jones" wrote:
>It all starts with this: > >nWidth := InterfaceManager.ContentWidth(editText.Font, AString); Thanks, Matthew. Using that on the string gave me a nWidth = 593. The Edit control has a Width = 400. So how many chars of the string do I need to copy to fill up the TEdit control whose width is 400 ? // Thom |
Fri, May 19 2017 11:48 AM | Permanent Link |
Matthew Jones | thomh wrote:
> So how many chars of the string do I need to copy to fill up the TEdit control whose width is 400 ? Create a temporary copy of the string. Loop around measuring the string and deleting a character from the end until it fits. -- Matthew Jones |
Fri, May 19 2017 12:57 PM | Permanent Link |
thomh | "Matthew Jones" wrote:
>Create a temporary copy of the string. Loop around measuring the string and deleting a character from the end until it >fits. Got it. Thanks, Matthew. // Thom |
Fri, May 19 2017 2:28 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Thom,
Just be forewarned: measuring strings in the browser is *slowwww*. It's why EWB goes to very great lengths to do so as sparingly as possible. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, February 14, 2025 at 12:13 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |