[REBOL] Re: Grouping in Layout
From: carl:cybercraft at: 27-Jun-2002 9:52
On 27-Jun-02, laplace wrote:
> Hello,
> I'm looking at rebolview, I tried to do a very simple thing: an
> image gallery with a title with each image and I can't cope with
> below, across and return ?
> This one is ok
> across
> image %pic1.gif
> image %pic2.gif
> return
> image %pic3.gif
> image %pic4.gif
> return
> But how to group an image with its title ?
> across
> [
> image %pic1.gif
> text "pic1"
> ]
> [
> image %pic2.gif
> text "pic2"
> ]
> return
> [
> image %pic3.gif
> text "pic3"
> ]
> [
> image %pic4.gif
> text "pic4"
> ]
There's different ways you can do it. Panels are one way as
suggested, but you can do it quite easily in a standard layout. An
example:
First, just some code to make a block containing 4 images and their
titles...
obj: make object! [pic: text: none]
blk: []
for n 1 4 1 [
append blk make obj [
pic: to-image layout [box blue to-string n]
text: join "Pic " n
]
]
Then a couple of layouts using them...
view layout [
across
image blk/1/pic pos:
below
text blk/1/text 140 center
image blk/3/pic
text blk/3/text 140 center
at pos guide
image blk/2/pic
text blk/2/text 140 center
image blk/4/pic
text blk/4/text 140 center
]
view layout [
across
image blk/1/pic
image blk/2/pic
return
text blk/1/text 140 center
text blk/2/text 140 center
return
image blk/3/pic
image blk/4/pic
return
text blk/3/text 140 center
text blk/4/text 140 center
return
]
The 140's are just the width of the images there. To get them from
the pictures use...
text blk/1/text blk/1/pic/size/x center
HTH.
--
Carl Read