Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Characters in a string on the fly 1

Status
Not open for further replies.

Khartoum

Programmer
Jun 30, 2012
11
AU
I have a need to display the number of charchters in a string when a user is enetreing text. Am looking for a way to display the length of the string as each charachter is typed in.
Am sure it must be in an embed somwhere, possibly with an API call perhaps?
Any Ideas how to do this please?
 
Hi,

you could use timer-event.
In timer-embed you can get LEN() of string and display.

cagiv
 
Thanks Cagiv, good Idea. I'll give it a go!
 
There is another method which will do it directly with the entry control without using the timer:

From entry control properties check on the immediate check box in extra tab.
then go to the embeds of that control, you will find new event which is (NewSelection). In this event you can put your code.


suppose your entry field is aaa, the the code will be :

Code:
update(?aaa)
xx=len(clip(aaa))
display(?xx)

Regards.


 
Thanks for the second post, but seems not to work as well. This only updates the character count after leaving the text entry field - unless I am doing something wrong, which is likely!
 
Hi
it should work becuase Iam using in in my applications for different cases.

Are you sure you did step 1
(From entry control properties check on the immediate check box in extra tab).


Regards
 
Something screwy here.(Me probably). I am using version 8.
I have a string entry field called GLO:Forecast which e usEr enters the text, and needs to know the character length (which then gets sent out as an eText message.
When I look at the properties, there is no immediate option to select. The only 'immediate' option I can find is the 'Window' propertie, hence only gets updated, I guess, when User complets the field and exits, displays the total character length then.
I take it that you have an 'immediate' option available when looking at your text entry properties ? What kind of field are you using to enter the string? I wonder if it is not available on my global variable and have to use a local proxy?
While cagiv's option works well, your idea sounds better as I am wary that a 'Timer' might cause other problems, slow dows, conflicts etc.
 
Hi
Iam using clarion 6.3, any how find the attached file which is an simple application with the source (I think it will be converted when you open it in ver 8.. not sure) but the exe should be running fine to show you the idea.

Regards
 
 http://skworkarea.info/cnt_test.zip
Brilliant. Thanks for the example, works as advertised - even when compiled with version 8.
Helped enormously to track down the issue for me. Basically, did not get an 'immediate' in the properties dialogue, so I 'hard coded' IMM into the widow declaraiotn and have got it working in my app. Thanks a million for your time and effort, much appreciated.
 
Note :
Actually me and SalehKiswani are working in the same office and sometimes we use the same PC (actually sometimes I use his PC [blush]), because of that sometimes replies are mixed

So Iam writing again from my account .. you are welcome.

Bset Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top