3.4.3 Active regions
When you are using active region methods, there are two processes of interest:
with-scheduling-allowed
with care. This macro is described in Chapter 5, "The Multitasking Facility" in The Advanced Users Guide. Any function that you specify in make-active-region
is run in the window input process, not in your process. This arrangement produces certain constraints on your function, such as those that are listed below.
pop-up-menu-choose
because it relies on the invocation of an active region method.;;; Create a window with an active region. Any click in the active ;;; region displays a pop-up menu that allows you to set or clear ;;; all the bits in the window's bitmap.There are two other ways in which multitasking can affect you: the behavior of streams in the Debugger and the behavior of the Common Lisp(setq *window* (make-window :width 100 :height 100)) (defun choose-window-color-from-menu () (let* ((menu (make-pop-up-menu (list (cons "Clear all bits" :clear) (cons "Set all bits" :set)))) (item (pop-up-menu-choose menu))) (if (eq item :clear) (draw-rectangle *window* 0 0 :width 200 :height 200 :operation boole-clr) (when (eq item :set) (draw-rectangle *window* 0 0 :width 200 :height 200 :operation boole-set)))))
(defun handle-mouse-click (viewport region char x y) "handle mouse click in window" (make-process :name "Choose Color" :stack-size #x2000 :function 'choose-window-color-from-menu :args nil :restart-action :restart))
(make-active-region (make-region :width 200 :height 200) :bitmap *window* :mouse-click \#'handle-mouse-click)
throw
special form. For information about these behaviors, see Chapter 5, "The Multitasking Facility" in the The Advanced User's Guide.
Generated with Harlequin WebMaker