r3bazaar
r3bazaar copied to clipboard
Can't modify gob/draw directly
GOB! type is for GUI, if you create a GUI element with draw or modify another gob/DRAW:
a: make gob! [draw: [line 0x0 100x100]]
view a
You'll obtain an error like:
** Script error: expected command! not line
This is not a bug, DRAW expects block of commands, not a dialect.
The original idea was different, see http://www.rebol.com/r3/docs/view/gobs.html
@carls idea was to access directly to /draw refinement of a gob, very similar to Rebol 2 way.
At the moment Boleslav Březovský proposed this solution with to-draw function:
>> gob: make gob! [draw: []]
== make gob! [offset: 0x0 size: 100x100 alpha: 0 draw: []]
>> to-draw [pen black fill-pen red circle 50x50 40] gob/draw
== [pen 0.0.0 fill-pen 255.0.0 circle 50x50 40x40]
>> view gob
But the best solution would be that view automatically passes the /draw content to to-draw or something similar.