[plt-scheme] event binding help

From: briand at aracnet.com (briand at aracnet.com)
Date: Sat Feb 28 11:46:13 EST 2004

Here's what the flow looks like now:

(canvas
  (on-subwindow-event
    (lots of event/state checking to draw line
     ...

what I want is:

(canvas
  (on-subwindow-event
    (mouse-button-down
     .. draw-line

(draw-line
  
And there is where I'm not sure about the next step.  I would like to
set up draw-line so that it now automagically captures the event I'm
interested in.  So if I get button-down, backspace, esc, etc.. it
should automatically go to draw-line, until draw line "releases" those
events.

Here's how I would do this in stk:

(define draw-line
  (let ((button-press-proc
        (escape-key-proc
        ...

   (bind button-press-proc button-press-event ...)
   (bind escape-key-proc  escape-key-proc ...)
   ...

And ultimately this really follows from Tk.

Unfortunately, after perusing the documentation, it's not obvious to
me how to do this without simply putting a brute force event filter in
on-subwindow-event and dispatching based on mode.  And that seems like
a very kludgey way to do it.




Brian


>>>>> "Bruce" == Bruce Hauman <bhauman at cs.wcu.edu> writes:

  Bruce>   For list-related administrative tasks:
  Bruce>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

  Bruce> briand at aracnet.com wrote:

  >> 
  >> A simple outline of the approach which would work best with mzscheme
  >> would be most helpful.
  >> 
  >> 

  Bruce> Maybe some more information would be helpful.  I am assuming
  Bruce> the line drawing routine you are refering to is reacting to
  Bruce> mouse input to draw the line.

  Bruce> If you are drawing on a canvas% I believe you would be
  Bruce> interested in the on-event method, which is invoked when
  Bruce> mouse events occur. You can have on-event forward its events
  Bruce> to a mutable method which you can mutate with the button
  Bruce> press callback/event.

  Bruce> I can describe this process in more detail if you think I am
  Bruce> on the right track.

  Bruce> Bruce Hauman


Posted on the users mailing list.