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

[REBOL] Re: help? dynamic images

From: james:mustard at: 29-Oct-2001 10:01

> >I haven't done it by index, but I have done it by face. I.e. the user can > >click on a face (an image in your case) and hit Ctrl+Delete. I watch for > >keystrokes and if I see Ctrl+Delete in a face, I do this:
Hi Russ, just done something similar in my gui builder - when creating objects i set a global called current-object that points to the face just created. I also bind feel/engage to reset the current-object to the object receiving the event, eg: make-this: func ['obj] [ hide-popup-list if not work-form-hidden [ append work-form/pane v: make-face obj current-object: v v/offset: creation-point if none? v/color [v/color: white] v/feel: make v/feel [ engage: func [face action event][ current-object: face if action = 'down [ start: event/offset stop: false hide-popup-list remove find face/parent-face/pane face append face/parent-face/pane face ] if action = 'alt-down [ stop: true show-popup-list face event "object" ] if not stop [ if find [over away] action [ hide-popup-list face/offset: face/offset + event/offset - start if snap-to-grid [face/offset: face/offset - (face/offset // grid-size)] show face ] ] ] ] show v show work-form ] ] Modifying the feel/engage lets me add context sensitive help and do direct object manipulation when I otherwise wouldn't know which face was being accessed. From this point deletion is fairly simple with: delete-current-object: does [ if none? current-object [exit] if work-form-exists [ remove find work-form/pane current-object show work-form ] current-object: none ] Regards, James