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

Multi-processes



I am trying to process two events simultaneously.  One event is to move
an object around in a window when the mouse is pressed and held down 
and turn on a switch.  Another event is to run water after its switch
has been turned on.  Then I need turn off the switch while the water
is still running.  I used the the function eval-enqueue to do those.
However, the water did not run when the mouse was pressed and held down
in order to turn off the switch.  Here is my code:

(defmethod view-click-event-handler ((item my-window) position)
  (let* ((lastpos position)
         locate-pos-h
         locate-pos-v
         cpos
         (tolerance 3)
         (mypos (view-position item))
         (delta (subtract-points lastpos mypos)))
    (my-while (#_stilldown)
      (Setq cpos (view-mouse-position (view-container item)))
      (when (or (>= (abs (- (point-h cpos) (point-h lastpos))) tolerance)
                (>= (abs (- (point-v cpos) (point-v lastpos))) tolerance))
      (Setq lastpos cpos)
        (let* ((mypos (view-position item))
               (mybotright (add-points mypos (view-size item))))
          (erase-rect (view-container item) (point-h mypos)
                (point-v mypos) (point-h mybotright)
                (point-v mybotright))
          (setq locate-pos-h (+ (point-h mypos) (/ (- (point-h mybotright) (point-h mypos)) 2)))
          (setq locate-pos-v (+ (point-v mypos) (/ (- (point-v mybotright) (point-v mypos)) 2)))
          )
        (view-draw-contents item)
        )))
        (event-processing item locate-pos-h locate-pos-v)))

I realize that the best way to do the two events is the use of multi-processes,
but I do not know if MCL provides the function of multi-processes.  Can anyone
tell me how to improve my work?  Thanks.

jipan@gmuvax2.gmu.edu