5

Here is the code pruned down to a minimum to show the error:

Rebol []

view center-face layout [
    fld1: field
    fld2: field
    flds: [fld1 fld2]
]
Graham Chiu
  • 4,856
  • 1
  • 23
  • 41
johnorork
  • 51
  • 5

1 Answers1

3

Here is the shortest example to show the error:

layout [ test: []] 
>>Misplaced item: []

Rebol uses a number of different dialects, and the two you are using in this example are the do dialect and the view dialect. Now inside the 'layout function, you can only have the view dialect but you have mixed the two. So, the parser used by the 'layout function complains of the misplaced item. The dialect expects to see after flds: one of the faces such as field, area, label etc but instead finds a block.

Regarding your clarification comment, if you wish to create a block of fields, you can just create the block first and then provide it to the 'layout function like this so that you end up with fields named var1 to var9.

lo: [ across ]

for i 1 9 1 [
    repend lo [ 'label  form join "var" i to set-word! join "var" i 'field 'return ]   
]

view layout lo
Graham Chiu
  • 4,856
  • 1
  • 23
  • 41
  • That's very helpful. Thanks. I am trying to create a block of fields that I can test in a foreach loop. If i try to load up the block outside of the view block it probably wont see those fields. So is there any way to do what I want here? – johnorork Mar 31 '14 at 07:28
  • Not sure what you want to do so I just expanded my answer to show how to create the layout block programmatically. – Graham Chiu Mar 31 '14 at 09:10