Detecting wrap in a field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Detecting wrap in a field

Post by WaltBrown » Tue Dec 06, 2011 2:58 am

Hi!
Is there a message sent by a field when a line wraps? I have two fields which contain input and output file paths in a second line in a main stack very similar to LC's Menu Bar stack (the rest of the app is substacks which automatically dock under the bar). Paths of course can be quite long. If the user resizes the stack, I have these two fields set to auto-size their widths in the resizeStack handler. I was wondering if there was a simpler way to tell the stack and the fields to increase their height to accomodate wrapping in the two fields, rather than having to measure each field "manually" in the resizeStack handler.

I don't think there is, but I thought there might be a chance (at least 1 in 3, the usual case...) that I missed something.

Thanks, Walt
Walt Brown
Omnis traductor traditor

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Detecting wrap in a field

Post by dunbarx » Tue Dec 06, 2011 6:57 am

I don't think there is either. You can certainly monitor such an event by checking the text against the formattedWidth property.

Craig Newman

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Detecting wrap in a field

Post by WaltBrown » Tue Dec 06, 2011 4:54 pm

Turns out there is a long standing Feature Request (among the many for field formatting issues), 727, to have an option for wrapping in fields of strings without whitespace, if anyone would like to add some votes. The workaround offered, to make the field unicode, seems to bring in too many other unwanted side effects to be viable.

Walt
Walt Brown
Omnis traductor traditor

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Detecting wrap in a field

Post by dunbarx » Tue Dec 06, 2011 5:00 pm

I'm in. It is unconscionable that whitespace is required to force a wrap. The formattedWidth ought to rule, char by char.

Craig Newman

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Detecting wrap in a field

Post by WaltBrown » Tue Dec 06, 2011 5:10 pm

Plus, if I make a hard wrap routine for the field, that then leaves a CR in the string, which I then have to detect and remove when I use the field contents, which then means I have to differentiate between content returns and hard wrap returns,... etc, etc. so programmatically adding hard wrap will really not work, it must be part of the field display properties.
Walt Brown
Omnis traductor traditor

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Detecting wrap in a field

Post by mwieder » Tue Dec 06, 2011 7:33 pm

I'm out of votes, but I'm in as well. I hope the team takes this into account when we finally get a new formatted field object. Not that I'm holding my breath waiting for this, but whitespace shouldn't be the only criterion for determining wrap.

Post Reply