Page 1 of 1

Detecting wrap in a field

Posted: Tue Dec 06, 2011 2:58 am
by WaltBrown
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

Re: Detecting wrap in a field

Posted: Tue Dec 06, 2011 6:57 am
by dunbarx
I don't think there is either. You can certainly monitor such an event by checking the text against the formattedWidth property.

Craig Newman

Re: Detecting wrap in a field

Posted: Tue Dec 06, 2011 4:54 pm
by WaltBrown
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

Re: Detecting wrap in a field

Posted: Tue Dec 06, 2011 5:00 pm
by dunbarx
I'm in. It is unconscionable that whitespace is required to force a wrap. The formattedWidth ought to rule, char by char.

Craig Newman

Re: Detecting wrap in a field

Posted: Tue Dec 06, 2011 5:10 pm
by WaltBrown
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.

Re: Detecting wrap in a field

Posted: Tue Dec 06, 2011 7:33 pm
by mwieder
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.