Page 1 of 1
Limit the label field
Posted: Thu Jun 17, 2010 1:40 pm
by alemrantareq
Hi everybody, I want to know two things -
1. How to limit the char entry in the label field? (i.e. Max five chars can be input in the label field)
2. Only numbers and letters will be allowed in the label field.
I think the aboves are very easy to scripting. I just forgot them & can't remember........pls help me

Re: Limit the label field
Posted: Thu Jun 17, 2010 3:44 pm
by dunbarx
Label fields usually have their text locked, among other things. They are used for displaying text that does not change, and one rarely types into them. I think you are asking about text fields. Try this in the field script:
Code: Select all
on keyDown var
if var is in ".0123456789abcdefghijklmnopqrstuvwxyz" and the length of me < 5 then put var after me
end keyDown
Note that you should test this to make sure it does what you want.
Craig Newman
Re: Limit the label field
Posted: Thu Jun 17, 2010 6:09 pm
by alemrantareq
Thanks
Craig Newman for reply........yes i was wrong......I asked for the text field. Your script works good but I found a little problem. If I want to input a new char in the middle of text, it goes to last. I think the standard script will be -
Code: Select all
if theKey is a number and theKey is......then pass keyDown.......something like this.
Re: Limit the label field
Posted: Thu Jun 17, 2010 8:40 pm
by dunbarx
Yep, that is why we must test, test, test.
Change the script just slightly.
Code: Select all
on keyDown var
if var is in ".0123456789abcdefghijklmnopqrstuvwxyz" and the length of me < 5 then put var after the selection
end keyDown
Do you see the difference? Playing with these adorable features of Rev is the best way to learn.
Craig Newman
Re: Limit the label field
Posted: Fri Jun 18, 2010 3:23 am
by alemrantareq
Thanks
Craig Newman, yes I strongly agree with you.
Yah, your new script works perfect. I made a slight difference & it also works for me -
Code: Select all
on keyDown theKey
if theKey is in ".0123456789abcdefghijklmnopqrstuvwxyz" and the length of me < 5 then pass keyDown
end keyDown
CHEERS !!!
