[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help



I'm building a region from a user's click-and-drag and associating it with
a target which will then be selected.

I have something like this:

(defmethod view-click-event-handler ((view zoomer) where)
  (let ((rgn (build-region view where))
        (target (funcall (target-selector view) view))))
    (add-subviews (make-instance 'hot-spot :region rgn :target target))))

Now, it's entirely possible that after making the hot-spot, the user will
not like any of his/her choices or will realize that the region made is
"not right".  

Ideally, then target-selector will have a cancel option.

How do I catch whether or not the target was cancelled?

[I need to dispose the rgn, if so.]

I'm not quite sure how to use unwind-protect and/or catch-cancel in this
case...

I *don't* want the behavior I've indicated changed:
  1.  User clicks on zoomer and drags to build region.
  2.  User is presented with a selection of targets to associate with rgn.
      User *may* press cancel to forget the whole thing.
  3.  Call #_DisposeRgn *ONLY* if the user canceled in step 2.

I'm probably just being stupid, but I can't get my brain to figure out how
to set this up.
"TANSTAAFL" Rich lynch@ils.nwu.edu