Source language: Translate to:

About TextEntry

General questions about NeoBook

Moderator: Neosoft Support

About TextEntry

Postby StarterPack » Thu Apr 21, 2016 1:54 am

Hi Guys

I know that you can set a TextEntry box to allow only a certain amount of text, numbers etc. Is there a way that when i sized my TextEntry box to write to the end of the box and then it must stop. Cause when you use spaces in your words or numbers it also counts and then stops before the end.
And also when i use a TextEntry box with Multi-Line enable, if i'm at the last line end it must stop, so it must not scroll up.

Thank You
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: About TextEntry

Postby dpayer » Thu Apr 21, 2016 10:10 am

How about something like this:
Code: Select all
StrLen "[textentry1]" "[text1len]"
If "[text1len]" ">" "[MaxStrLen]"
StickyNote "-1" "-1" "Maximum entry [MaxStrLen] characters" "500"
SubStr "[textentry1]" "1" "[MaxStrLen]" "[textentry1]"
SendKeys "" "{Tab}"
Endif


Put this in the "Text Change" tab of the Actions property for the text box. Set the variable for "[MaxStrLen]" to be the length you want.
The Stickynote is just to inform the user of the limitation. If more gets forced into the entry field, the SubStr will clip the right amount of characters and put them back in. The sendkeys tab will get the input out of the textbox.

You may want to make the max # characters to be one more than the desired amount so the user is informed of the limit.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: About TextEntry

Postby StarterPack » Thu Apr 21, 2016 1:51 pm

Hi dpayer

Thank You, this script i can use somewhere else, but is not what i'm looking for. If i create a TextEntry with 165 width i want to write till the box is full and then it must stop. Doesn't matter how many spaces i use. I can say that i only want 15 letters to be written in the box, but when you use spaces it will count as a number and it will not write till the end.

Example
THISISWHATIMEAN]box stops here - 15Letters
and
THIS IS WHAT I ]This is also 15Letters but with spaces and the problem is you don't know how many spaces the user uses to fill in a form.
I need this to print a form, but when you put too much letters in a box it will scroll forward and then you cannot print everything. When you say only 15 letters etc allowed then it won't write till the end of the box especially when they use spaces.

It would be great if you can write in the box and when it's at it's end the box expands automatically. But i guess not :)
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: About TextEntry

Postby mishem » Thu Apr 21, 2016 2:11 pm

Image
Image
Image
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: About TextEntry

Postby dpayer » Thu Apr 21, 2016 2:48 pm

dpayer wrote:updated:
Code: Select all
StrReplace "[textentry1]" " " "" "[textentryupdated1]" ""
StrLen "[textentryupdated1]" "[text1len]"
If "[text1len]" ">" "[MaxStrLen]"
SendKeys "" "{Tab}"
Endif


Put this in the "Text Change" tab of the Actions property for the text box.


This simply strips out the spaces (and if people put in other characters, you will need to replace those too). You can control what can be entered using the style section of the text entry properties.
You have to decide if you want to allow spaces or not. If you want to allow spaces to be entered, you can count them and then add that number to the maximum length of characters for your [MaxStrLen].
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: About TextEntry

Postby StarterPack » Thu Apr 21, 2016 2:52 pm

HEHE :) GREAT STUFF

LOVE YOU MAN..... THANK YOU!!!!!
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: About TextEntry

Postby StarterPack » Thu Apr 21, 2016 3:00 pm

dpayer, this works great, just what i need. Just out of curiosity, if i set my textentry to 400 width, can i also tell the script to write only that lenght?
StarterPack
 
Posts: 115
Joined: Fri Feb 19, 2016 6:55 am

Re: About TextEntry

Postby dpayer » Sat Apr 23, 2016 8:40 am

StarterPack wrote:dpayer, this works great, just what i need. Just out of curiosity, if i set my textentry to 400 width, can i also tell the script to write only that lenght?

Should not be a problem.

But if you are truly acting out of curiosity, then just try it and see if it works first! Then if there are problems, tell us what you tried.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests

cron