Page 1 of 1
Automatic new line in text field
Posted: Thu May 04, 2006 1:42 pm
by lbtony
I have a text field with multiple lines. I want the cursor to go to the beginning of the next line when it reaches the end of current line. How to do this? At the moment, when the cursor reaches the end of a line, it just keeps going beyond the bound, I and can't find something in the prop settings to solve this problem. Thank you....
Posted: Thu May 04, 2006 4:06 pm
by kray
set the 'dontWrap' of the field to true
Posted: Thu May 04, 2006 4:07 pm
by Mark
Open the property inspector of your field and uncheck the Don't Wrap checkbox. You can also use this syntax:
set the dontWrap of fld "Your Field" to false
Best regards,
Mark
Posted: Thu May 04, 2006 7:16 pm
by mcgrath3
You can then select after line x of field y
and with the don'tWrap as false it will jump to the end of the line.
Tom
Posted: Fri May 05, 2006 8:42 am
by lbtony
Unfortunately, unchecking the "don't wrap" field doesn't seem to work. it still keeps going to the right but doesn't start a new line.
P.S.
I used a Text Entry Field with multiple lines.
Do I also need some handlers to do this?
Posted: Fri May 05, 2006 8:47 am
by malte
Hi,
it will only break the line if the contents of the line is not a single word. As soon as there is a space in it it will work, but I think that is not what you are after...
What you want might be possible to script though...
A quick start out of the top of my head:
In the fields script
Code: Select all
on keyDown theKey
if the formattedWidth of me > the width of me then
put cr before char -1 of line -1 of me
put theKey after line -1 of me
select after line -1 of me
else
pass keydown
end if
end keyDown
Hope that helps,
Malte
Posted: Fri May 05, 2006 8:49 am
by malte
Just checked and it works, given you type continiously and keep the text insertion point always at the end of the field. If you need a more sophisticated version, that takes care of changing the insertion point please let me know.
All the best,
Malte
Posted: Fri May 05, 2006 8:57 am
by Mark
Nice solution, Malte.
Now, fogive me being curiouse please, Tony, but what do you need it for?
Mark
Posted: Fri May 05, 2006 9:31 am
by lbtony
Thanks Malte, thats really helpful....
The reason I need it is because I have a quite narrow text field on a quite narrow stack

so on some lines it goes out of bound, but I want all the text to be displayed
to be honest, I'm a bit new to runrev, so I'm sorry if my questions sound naive

Posted: Fri May 05, 2006 10:00 am
by Mark
Hi Tony,
It is not naive at all, in fact your idea is very good and it is very understandable that you don't immediately think of the formattedwidth when you're new to Rev.
Enjoy the Revolution.
Mark