[REBOL] Re: VID questions
From: gjones05:mail:orion at: 25-May-2001 6:41
> From: GS Jones
> > Almost too many to mention.;-)
> > These are the two official ones:
> > http://www.rebol.com/docs/easy-vid.html
> > http://www.rebol.com/docs/view-guide.html
From: Robert M. Muench
> Yes, I have read them but these docs just mentioned
> the objects... that's it. Anyway, I'm seeking through
> all kind of postings and collecting knowledge from
> all the samples posted.
Until something more complete and definitive comes up, I guess that is
the best approach. :-(
Allen Kamp's Rebolforces.com site contains archived versions of
documentation that is a little different than the current officially
released documents. If you can tolerate some redundancy of information,
it goes into a bit more detail about /View faces. For what its worth to
you:
http://www.rebolforces.com/archive/view099users.html
> I find it even more strange that I can't define
> Rebol variables inside the layout stuff:
> view layout [
> myblock: make block! []
> ]
> Won't work. So the pattern to use VID is to
> have the GUI collect all kind of data and transfer
> them to outer Rebol variables for later processing.
Yes. And this highlights the fact that VID is a dialect that requires a
controlled vocabulary of VID words. If you would like to create some
words/objects within the layout structure, you are allowed to include a
'do [] that runs on evaluation. For example:
view layout [
button "click"
button "don't click"
do [
myblock: make block! [
my-var-a: 4
my-var-b: 2
]
]
]
This may be all that you are looking for.
Dialects are neat and powerful, and I personally look forward to tapping
into their rich potential, but it does require some re-thinking of how
to achieve a programming goal.
> Ok, is there a way to have a right
> alignment for a group of text/labels etc.
> which will set the size to the longest
> text? Otherwise you have to find the
> optimal size yourselfe.
Yes, you are right, and no, I can't think of an easy, more efficient way
right off hand. ALong the same line of how long a bit of text will be
(after rendering), you will soon discover that if you reassign text or
txt information that only the length of pixels of the original text will
be rendered. Again, an example is worth a thousand words (two thousand
of *my* words;-). Run the following:
view layout [
t1: txt "Hi"
button "Change Text" [t1/text: copy "Hello" show t1]
]
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]
]
Ahhh, that's better ... sort of. What if one doesn't know how long a
scrap of replacement text will be??? 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