mierlp Posted June 28, 2013 Posted June 28, 2013 Hi, I have a UniDBMemo on a form where the user may enter max 80 characters, I use the code below to display the amount of remaining characters with the UniDBMemoChange event. TextLen := 100-Length(StringReplace(StringReplace(UniDBMemo_Motivation.Text, #10, '', [rfReplaceAll]), #13, '', [rfReplaceAll])); UniLabel_Count.Text:=intToStr(Textlen); But how to prevent the user entering more than 80 characters ? Regards Peter Quote
Sherzod Posted June 29, 2013 Posted June 29, 2013 Hi mierlp.Try this:Add the code in UniDBMemo1.ClientEvents.ExtEvents function OnChange (sender, newValue, oldValue) { if (sender.getValue().length > 80) { sender.setValue(sender.getValue().slice(0, 80)); } } This is one of the solutionsSincerely. 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.