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?
Maximum length in multi-line edit box
Re: Maximum length in multi-line edit box
Maximumlines property works for us. Did you see that one?
Art Tostaine
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Maximum length in multi-line edit box
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