[REBOL] Re: VID questions
From: gscottjones::hotmail at: 25-May-2001 9:24
From: "Allen Kamp"
> > Nice, uh? The current work-around I use is as distasteful as you
> > with right aligning labels, namely:
> > view layout [
> > t1: txt "Hi" 80x16
> > button "Change Text" [t1/text: copy "Hello" show t1]
> > ]
> Scott, there is no need to set height in the above example
> Using just the width i.e t1: txt "Hi" 80 , allows the text to wrap
> width, very handy if you are laying out a paragraph and don't know how
> it will be the height will autosize.
If I knew that before, I had clearly forgotten. Thanks!!
> >I've been wishing and asking of
> > there is a way to calculate the rendered size of text so that this
> > be programmed dynamically. No answers so far... :-(
> > If I run across a ggod example on the alignment problem, I'll
> > forward it.
> Scott here is an example for you,
> view lay: layout [
> t1: text "Hi" black gray
> button "Change Text" [
> ; temporarily set to the max width you wish to allow,
> ; this allows text to stretch out
> t1/size: lay/size
> t1/text: "Resize for Scott :-)"
> t1/line-list: none
> ; now set the label size back to the text size
> ; and add a bit to allow for margins & edge
> t1/size: 4x4 + size-text t1
> ; finally show the result
> t1 show t1
> ; Should I add this to my FAQ?
Most definitely (add it to the FAQ). Your response and Brett's response
have been very helpful to me. Now, for Robert's question on right
aligning labels .... :-)
I'll have to play with this newly learned functionality. I'll also be
happy to start perusing your website, looking for possibly out-of-date
/View beta stuff. It'll serve as a nice reminder on /View basics, too!