Set length of textbox

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Set length of textbox

Post 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.
All The Best,
Franco
Canada
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Set length of textbox

Post 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
have fun
Jimmy
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Set length of textbox

Post 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
All The Best,
Franco
Canada
Post Reply