The whole point of my stack was to wrap a long string that contained NO spaces.
Richmond. from my jail-broken, recycled iPad 1 On 16 Mar 2015, at 00:03, Scott Rossi <[email protected]> wrote: > > On 3/15/15, 1:10 PM, "Richmond" <[email protected]> wrote: > >> On 15/03/15 21:53, Scott Rossi wrote: >>> I have a text field that is filled with tab delimited glyph characters >>> from an icon font (FontAwesome). The field wraps as expected in LC 6.7, >>> but displays all characters on a single line in LC 7.0.3 regardless of >>> the >>> dontWrap setting. The dontWrap property works because if I place Roman >>> text in the field, it wraps as expected. >>> >>> This seems due to the new Unicode text handling, but now how now do I >>> get >>> the field to wrap its glyph character text? >>> >>> Thanks & Regards, >>> >>> Scott Rossi >>> Creative Director >>> Tactile Media, UX/UI Design >>> >>> >>> >> http://forums.livecode.com/viewtopic.php?f=6&t=10810&start=30 >> >> Richmond. > > > The bottom line is one shouldn¹t have to do anything like this when text > is separated by spaces or tabs. Text should wrap automatically. > > That said, if using LC 6.5 or later, you can do what you show in your > stack much more dynamically by using something like the measureText > function within a resizeControl handler. Unlock your source field, and > add the following script to the field: > > on resizeControl > local theWrappedText > put width of me into myWidth > put margins of me into myMargins > subtract item 1 of myMargins from myWidth > if item 3 of myMargins is not empty then > subtract item 3 of myMargins from myWidth > else subtract item 1 of myMargins from myWidth > put text of me into myText > replace return with empty in myText -- RESET TEXT > lock screen > put 1 into S > repeat with N = 1 to number of chars of myText > put measureText(char S to N of myText,me) into theLineWidth > if theLineWidth > myWidth then > put return after theWrappedText > put N into S > end if > put char N of myText after theWrappedText > end repeat > set text of me to theWrappedText > unlock screen > end resizeControl > > You also make the field wrap instantaneous by placing the field in a group > and triggering the wrap from resizing the group since groups generate the > resizeControl message while they¹re being resized. A sample of this has > been uploaded to your post in the forum. > > Regards, > > Scott Rossi > Creative Director > Tactile Media, UX/UI Design > > > > > > _______________________________________________ > use-livecode mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
