There are some tricks to building this LAYOUT as what you are trying to do is dynamically build it. I found a link that explained how to build dynamic LAYOUTS and was able to build this little script....
Rebol[
title: "Dynamic Matrix of Buttons"
author: "Brock Kalef"
]
matrix: copy [
space 0x0
style ntg toggle green red 24x18 font [size: 9 colors: pewter shadow: 0x0]
across
]
counter: 1
cols: rows: 5
row-cnt: :rows
col-cnt: :cols
while [row-cnt <> 0] [
while [col-cnt <> 0] [
temp: to set-word! rejoin ["cell" counter] ; creates variable
temp2: to-word rejoin ["cell" counter]
temp3: to path! compose [(temp2) state]
append matrix temp
append matrix 'ntg
append matrix to string! counter
append/only matrix compose [print (temp3)]
counter: counter + 1
col-cnt: col-cnt - 1
]
append matrix compose [return] ; reset column location at next row
col-cnt: cols ; reset max column count
row-cnt: row-cnt - 1 ; decrease row count
]
lay-display: layout matrix
;cell8/state: true ;works - must be after layout is made
;show cell8 ;works
view lay-display
You will notice the word MATRIX is defined first, this is the word that I am assigning all of the LAYOUT to.
I then loop through the creation of rows and columns of buttons (actually toggles, but they are essentially the same thing). Here I append items to the word 'matrix, which again is the word we are storing the building blocks of the layout in.
I then use...
lay-display: layout matrix
to actually create the LAYOUT and...
view lay-display
to view the layout.
There is some fancy stuff in the loop to define my toggle (button) names dynamically and the path values to be able to change the state of the toggles, but it's a bit tricky and I don't think I'd do it justice in explaining.
I know this is one way of doing it, but not sure if there is a better way. I hope this helps.
Brock