r3bazaar icon indicating copy to clipboard operation
r3bazaar copied to clipboard

Can't modify gob/draw directly

Open angerangel opened this issue 11 years ago • 2 comments

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

angerangel avatar Mar 18 '13 14:03 angerangel

This is not a bug, DRAW expects block of commands, not a dialect.

rebolek avatar Mar 19 '13 17:03 rebolek

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.

angerangel avatar Mar 20 '13 11:03 angerangel