reposition single-line text to the left or right?

Ken Ray kray at sonsothunder.com
Wed Apr 25 10:19:29 EDT 2012


On Apr 23, 2012, at 6:18 PM, Nicolas Cueto wrote:

> Hello All,
> 
> On the keyboard I made for my Android app, a typed letter gets added
> after the last typed letter onto a single-line text field (locked and
> wrap off). When the string of letters reaches the field's far-right,
> newly typed letters of course get added but out of sight off-field.
> 
> Is there an LC way (without relying on horizontal scroll) to move left
> the text-string/line as each new letter gets added to the end of the
> string? Likewise, shifted right when deleting last letters?

Well, you *could* do it by checking the formattedWidth of the field against the width of the field, and if it's larger, delete characters from the front of the text until the formattedWidth <= the width. But then you'd have to keep track of what the user entered in a custom property or variable. 

I noticed you say that your field is locked - if it was unlocked, then LC would just manage the hScroll of the field; I'm assuming you can't leave your field unlocked for some reason, so you can use use the same formattedWidth vs. width test and then set the hScroll of the field manually. But you mentioned "without relying on horizontal scroll"… is there a reason you don't want to use the hScroll?

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list