Page 1 of 1

Set length of textbox

Posted: Sat Sep 25, 2021 4:16 pm
by franco
If I have a textbox with maxlength 80, so I can print 80 characters to printer.
80 W`s go off the print page, where 80 I`s are only half the width of the paper
What I need is to be able to limit the length of the text box to the 8 inch paper size not number of characters.
Is there a way to stop entry at the width of the textbox, this would stop the problem, as I could set the character length by textbox width.
Thanks in advance.

Re: Set length of textbox

Posted: Sat Sep 25, 2021 8:12 pm
by AUGE_OHR
hi,

you can set TEXTLIMIT of TEXTBOX with EM_SETLIMITTEXT

Code: Select all

   hWnd := GetControlHandle( ControlName, ParentForm )
   SendMessage( hWnd, EM_SETLIMITTEXT, nLimit, 0 )
you can "calculate" length of String with

Code: Select all

   nLength := GetProperty ( FormName, ControlName, "GetTextLength" ) 
Tip : use "WWWWWWWWWW" and FONT, which you want to use, to "calculate" Limit

Re: Set length of textbox

Posted: Sun Sep 26, 2021 4:35 pm
by franco
Thanks Jimmy, I can not get to work but I already use when setting up text box which works. I thought I could maybe set when printing.

Code: Select all

DEFINE TEXTBOX TEXT_1
                                           //OTHER SETTINGS
MAXLENTH nLength
CASECONVERT UPPER