Page 1 of 1
Maximum length in multi-line edit box
Posted: Wed May 03, 2017 5:44 pm
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?
Re: Maximum length in multi-line edit box
Posted: Thu May 04, 2017 3:40 am
by atostaine
Maximumlines property works for us. Did you see that one?
Re: Maximum length in multi-line edit box
Posted: Thu May 04, 2017 8:33 am
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