Maximum length in multi-line edit box

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Maximum length in multi-line edit box

Post by soa »

I need to restrict the number of characters entered into a multiline editbox but there is no maximum length property. I'd like the control to simply stop accepting keystrokes (except backspace or delete).

What is the best way to accomplish this?
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Maximum length in multi-line edit box

Post by atostaine »

Maximumlines property works for us. Did you see that one?
Art Tostaine
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Maximum length in multi-line edit box

Post by Stewart Marshall »

Assuming this is the web version that you're referring to, the best you can do today is to monitor the Changed event provide feedback to the user about the allowed number of characters.

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Width(817) Height(593)

Define_Com Class(#prim_vs.Style) Name(#Error) TextColor(Red)

Define_Com Class(#PRIM_TEXT) Name(#Text1) DisplayPosition(1) Left(35) Parent(#COM_OWNER) TabPosition(1) Top(31) Width(630) Height(250)
Define_Com Class(#PRIM_LABL) Name(#Characters) Caption('0/200') DisplayPosition(2) Ellipses(Word) Height(25) Left(543) Parent(#COM_OWNER) TabPosition(2) TabStop(False) Top(284) VerticalAlignment(Center) Width(120) Alignment(Right)

Evtroutine Handling(#Text1.Changed)

#Characters := ("&1/300").Substitute( #Text1.Text.CurSize.AsString )

If (#Text1.Text.CurSize > 300)

#Text1.Style <= #Error

Else

#Text1.Style <= *Null

Endif

Endroutine

End_Com
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
Post Reply