Scrolling Field Question

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Scrolling Field Question

Post by warrenk » Tue Nov 04, 2008 7:16 pm

Is there anyway to limit the length of each line of a scrolling field. I want the data to wrap after 50 characters (even if ENTER is not selected).

How would I do this? I tried the code below and it is not working (this was a total guess of how I thought it would work...so don't laugh if I am way off the mark).

on keyDown theKey
if the length of me = 50 then
put field "Notes" & CRLF into field "Notes"
pass keyDown
else
pass keyDown
end if
end keyDown

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Tue Nov 04, 2008 7:39 pm

I've a lot of reading ahead of me this morning so I haven't thought about your code too deeply, but I think there's just one too many pass statements in there.

Offhand (read, "untested" <g>) I think you should be able to get away with this:

on keyDown k
if len(me) < 50 then pass keyDown
end keyDown

Let me know if that doesn't do what you need and we'll come up with something that does.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Post by warrenk » Tue Nov 04, 2008 8:12 pm

Richard,

Thanks for the response. I just realized I had the don't wrap checked off on the field. When I removed this...everything worked. Stupid mistake!

Warren

Post Reply