Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thank you again! I can't tell you how much I and my company appreciate what you've done! I love this place!..."

Geography

Where in the world do Tek-Tips members come from?

Counting Characters in a string on the flyHelpful Member! 

Khartoum (Programmer)
30 Jun 12 17:49
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?
Helpful Member!  cagiv (Programmer)
2 Jul 12 3:14
Hi,

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

cagiv
Khartoum (Programmer)
2 Jul 12 3:57
Thanks Cagiv, good Idea. I'll give it a go!
Khartoum (Programmer)
2 Jul 12 4:12
Works a treat cagiv, many thanks.
newtoclarion (Programmer)
10 Jul 12 8:53
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.


Khartoum (Programmer)
14 Jul 12 2:53
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!
newtoclarion (Programmer)
14 Jul 12 6:29
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
Khartoum (Programmer)
14 Jul 12 22:42
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.
newtoclarion (Programmer)
15 Jul 12 8:21
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
Khartoum (Programmer)
16 Jul 12 16:44
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.
SalehKiswani (IS/IT--Management)
16 Jul 12 23:00
So Glad that you got your point.

Bset Regards
newtoclarion (Programmer)
17 Jul 12 5:18
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

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close