INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Counting Characters in a string on the fly

Counting Characters in a string on the fly

(OP)
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?

RE: Counting Characters in a string on the fly

Hi,

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

cagiv

RE: Counting Characters in a string on the fly

(OP)
Thanks Cagiv, good Idea. I'll give it a go!

RE: Counting Characters in a string on the fly

(OP)
Works a treat cagiv, many thanks.

RE: Counting Characters in a string on the fly

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.


RE: Counting Characters in a string on the fly

(OP)
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!

RE: Counting Characters in a string on the fly

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

RE: Counting Characters in a string on the fly

(OP)
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.

RE: Counting Characters in a string on the fly

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

RE: Counting Characters in a string on the fly

(OP)
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.

RE: Counting Characters in a string on the fly

So Glad that you got your point.

Bset Regards

RE: Counting Characters in a string on the fly

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!

Resources

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