rebol - VID layout pane supporting multiple face creations [rebol2] -


please consider simple rebol2 code illustrate problem:

rebol [] a: make face [     offset: 0x0     color: yellow     size: 20x20 ] b: make face [     offset: 0x0     color: red     size: 60x60     pane: reduce [         make [offset: 0x0]         make [offset: 10x10]         make [offset: 10x20]     ] ] view layout [     box 200x200 white [         pane: reduce [             make b [offset: 0x30] ;; 1 'instance' of b         ]     ] ] 

the main point here layout (or face) able display bunch of faces inside pane block in such manner multiple creations of same face (b in case) should possible. shown code works well, , instance (let me call way) of b displayed should be.

but suppose change code have, say, 2 instances of b:

view  layout [     box 200x200 white [         pane: reduce [             make b [offset: 0x30]             make b [offset: 0x10]         ]     ] ] 

at point error

** script error: face object reused (in more 1 pane): none ** where: view ** near: show scr-face if new [do-events] 

from message presume here face b somehow getting reused , messing i'm trying achieve. i've done lots of research on , @ point found possible around cloning (using make) face passed pane; that's thought doing, no success @ all.

given scenario, question is: how can go solve this? rebol2 ok provide "face-instantiation" or best try else outside rebol2 (perhaps rebol3)?

any appreciated.

as pointed out problem a reused, not b!

the layout function uses field called init handling things this. understand init first bound face , called do after face instantiated (at least partially).

in case using style command in layout (still partially using face object a )

view layout [     style         bb box 60x60         [             append init [                 pane reduce [                     make [offset: 0x0]                     make [offset: 10x10]                     make [offset: 10x20]                ]             ]         ]     panel 200x200 white [         @ 30x0 bb         @ 0x0  bb     ] ] 

the other alternative, bit more similar be:

b: make face [     offset: 0x0     color: red     size: 60x60     init: [         pane: reduce [             make [offset: 0x0]             make [offset: 10x10]             make [offset: 10x20]         ]     ] ] view layout [     box 200x200     [         append init [             pane: reduce [                 make b [ offset: 0x0 init ]                 make b [ offset: 0x60 init ]             ]         ]     ]  ] 

note init manually called within make clause in case. i'm not sure why needed. elegantly solved style

view layout [     style box yellow 20x20     style b panel red 60x60 [         @ 0x0   ; can in style use defined style         @ 10x10         @ 10x20     ]     @ 0x0 b     @ 0x60 b ] 

Comments

Popular posts from this blog

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

java - Incorrect order of records in M-M relationship in hibernate -