Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: dynamically adding images

From: brett:codeconscious at: 22-Oct-2001 17:35

Hi Graham,
> > > Anyone got a short example on how to add/remove images > > > dynamically to a face? > > > > Each image requires its own face, doesn't it? > > Don't think so. > > Perhaps I should clarify - I need to add from 1 to 400 of > the same image onto a face. I don't want to put 400 on to > the face and move them as required. I want to add/remove > them to/from the layout.
I'm a bit rusty not having used Rebol for a while (been travelling), but I think Carl is correct, each image is displayed by a face. If you need 1 to 400 images incrementally added/removed to/from a layout (the main face) then you will need 1 to 400 faces created/destroyed or shown/hidden at the appropriate time. So assuming you have a simple layout, create the new face and add it to the PANE block of the layout face. Try the following lines in the console. Note that the "print length?" is there to avoid returning a block of faces to the console which would cause a very long wait (lockup?). Also I used a second layout call to create the new-face so in actual fact I created two faces one of which is discarded (the face returned from the second layout). You could just as easily create the new face directly without using layout again. layout-face: layout [box red box green] layout [new-face: box blue] view layout-face print length? append layout-face/pane new-face layout-face/size: multiply layout-face/size 2x2 new-face/offset: add layout-face/pane/2/size layout-face/pane/2/offset view layout-face As I said, I've been away for a while so I've no idea what's been on the list and what hasn't - I hope it isn't redundant. Brett Handley