puzzled by draw grid size
[1/3] from: maksa::sezampro::yu at: 22-Sep-2001 12:59
Hello,
I have a simple table drawing thing.
(Example is simplified but still displays the problem)
REBOL [
Title: "A simple table with a colored header"
]
tablesize: 4x6 ; columns x rows
cellsize: 100x20
table: [
box linen cellsize * tablesize effect [
draw [
fill-pen mint
box 0x0 to-pair reduce [ first cellsize * tablesize second cellsize ]
]
grid cellsize; Expecting this to draw the grid around cells
]
]
view layout table
But the grid is drawn in some funny resolution I haven't specified (say
something around 7x7). I tried moving the grid command around, but to
no avail. Putting a literal 100x20 works, but I don't want to live with
that as it would break the idea of being able to reuse it for different
table and cell sizes.
What am I doing wrong?
Regards,
Maksa
[2/3] from: cybarite:sympatico:ca at: 22-Sep-2001 8:19
I guess it is because when the grid definition is being parsed by
layout, it is thinks that your variable is some noise and ignores it.
Maybe composing the grid effect outside of the layout would get you out of it.
(Example is simplified but still shows a solution)
tablesize: 4x6 ; columns x rows
cellsize: 100x20
box-effect: compose [grid (cellsize)]
table: [box linen cellsize * tablesize effect box-effect]
view layout table
[3/3] from: greggirwin:starband at: 22-Sep-2001 14:23
Hi Maksa,
If you compose your effect block, and put parens around cellsize so it gets
composed, you should be good to go.
tablesize: 4x6 ; columns x rows
cellsize: 100x20
table: [
box linen cellsize * tablesize effect compose [
draw [
fill-pen mint
box 0x0 to-pair reduce [ first cellsize * tablesize second cellsize ]
]
grid (cellsize); Expecting this to draw the grid around cells
]
]
view layout table
--Gregg