Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: VID questions

From: allenk:powerup:au at: 25-May-2001 23:51

> Nice, uh? The current work-around I use is as distasteful as you issue > 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 at the width, very handy if you are laying out a paragraph and don't know how long it will be the height will autosize.
>I've been wishing and asking of > there is a way to calculate the rendered size of text so that this could > be programmed dynamically. No answers so far... :-( > If I run across a ggod example on the alignment problem, I'll certainly > forward it. > Happy /View-VID'ing. > --Scott Jones
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? Cheers, Allen K