[ALLY] Re: Layout Bind or Context in stylized Layouts
From: jeff:rebol at: 13-Nov-2000 17:42
Howdy, Larry:
Welp, neato, we're all learning here. What you're looking at
below is an object that's put into the default vid-face
which holds functions to handle collecting "MULTI-facets"
and setting default values. In the older VID we'd do stuff
like:
view layout [
text "SOME TEXT" red
]
Styles only expected (could handle) a single facets (text,
color, etc...) Now you can stuff like:
view layout [
x: text "some text" "and" "even" "more" "text"
red green blue yellow pewter
[
print ["Texts:" mold x/texts newline
"Colors:" mold x/colors newline
"Alt-action:" mold get in x 'alt-action]
]
[blk2]
]
The MULTI/text function handles setting the default text for
the style while tucking away the rest of the strings in
FACE/texts, and multi/color sets the default and alternative
colors (foreground, background, etc..) while ferreting away
the others into FACE/colors. MULTI/block sets the
FACE/action, and then it defines FACE/alt-action if you have
another block. MULTI/file collects files, attempting to
load the first one as the default image for the face.
MULTI is an organizational object that helps with book
keeping for this more flexible VID Carl's developed over the
last few months. :-)
Fun stuff! --
-jeff
> I have been curious about MULTI object as well, it only
> appeared in recent exper builds, and so far no docs. For
> discussion purposes, here is a section snipped from the BOX
> style in vid-styles.
>
> multi: make object! [
> text: func [face blk][
> if pick blk 1 [
> face/text: first blk face/texts: copy blk
> ]
> ] size: func [face blk][
> if pick blk 1 [
> if pair? first blk [face/size: first blk]
> if integer? first blk [
> if none? face/size [face/size: -1x-1]
> face/size/x: first blk
> ]
> ]
> ] file: func [face blk][
> if pick blk 1 [face/file: first blk face/image:
> load-image first
[...snipped for bandwidth...]