Recent

Author Topic: (SOLVED)Label max length ....  (Read 4327 times)

codeman

  • Jr. Member
  • **
  • Posts: 78
(SOLVED)Label max length ....
« on: April 06, 2012, 09:21:08 pm »
Hi , how can i limit the input (length) in a label.caption  ? i dont find it as property ...
« Last Edit: April 06, 2012, 10:35:59 pm by codeman »
Lazarus v2.02 Win10

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Label max length ....
« Reply #1 on: April 06, 2012, 09:45:53 pm »
I don't understand. Do you mean length of the string ?
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

codeman

  • Jr. Member
  • **
  • Posts: 78
Re: Label max length ....
« Reply #2 on: April 06, 2012, 09:52:16 pm »
Yh basicly i insert numbers by clicking a button , i want to limit that insertion to 10 numbers max ... is that possible ?
« Last Edit: April 06, 2012, 09:54:05 pm by codeman »
Lazarus v2.02 Win10

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Label max length ....
« Reply #3 on: April 06, 2012, 10:09:30 pm »
Code: [Select]
if length(Label.Caption)<=10 then .....; //here you can add character
or better
Code: [Select]
if utf8length(Label.Caption)<=10 then ......; //here you can add character
Function utf8length() is in unit LCLProc, you will have to add it to your "uses".
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

codeman

  • Jr. Member
  • **
  • Posts: 78
Re: Label max length ....
« Reply #4 on: April 06, 2012, 10:29:10 pm »
OK , thnks !
Lazarus v2.02 Win10

 

TinyPortal © 2005-2018