Line count in text field

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Mar 20, 2012
Company: Abaco Soluciones S.A.

Hello.

I have multiline text field on form. I want to show to the user how many lines he entered into this field. Is it possible?

I tried to place simple text field with multiline option on, and also tried to place textdocument, but the problem is that the content of the field is updated only when the text control leaves focus.

 
#2
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 8, 2013
Company:

May be this script helps you:

Code
&AtClient
Procedure OnOpen(Cancel)
   AttachIdleHandler("UpdateInformation", 0.2);
EndProcedure

&AtClient
Procedure UpdateInformation()
   TextInField = Items.TextField.EditText
   // and blah blah blah......
EndProcedure

 
#3
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Mar 20, 2012
Company: Abaco Soluciones S.A.

Hello. Thank you for this script, but it doens't work well. When I try to put lines count on the form from the idle handler like

Code
LineCount = StrLineCount(TextInField); 


text entered in the field is dropping off. The best i managed to do is like this:
Code
 
LineCount = StrLineCount(TextInField);
TextField = TextInField;

but it also moves cursor to the beginning of the field, and if i still entering the text, i get something messed

 
#4
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 8, 2013
Company:

Try to change property "EditTextUpdate" of TextField. Or use DataProcessor in path.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.