[plt-scheme] Mouse and Canvas Object

From: Katsmall the Wise (kela_bit at netvision.net.il)
Date: Sun Apr 13 06:26:06 EDT 2003

(define/override (on-event e)
  (let ([type (get-event-type e)])
    (if (equal? type 'left-down)
        (handle-left-click))))

Define a function called handle-left-click in the same class. That will 
run whenever the left mouse button is clicked.
That's on-event in a nutshell, if you need me to be more specific, just 
email me again.

Katsmall the Wise

The Computer Man wrote:

>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>I'm define this for on-paint fonction
>(define $bitmap-canvas%
>  (class* canvas% ()
>    (inherit get-dc)
>    (define/override on-paint
>      (lambda () (send (get-dc) draw-bitmap $bitmap 0 0)))
>    (define/override (on-event e)
>        (send e button-down? 'left))
>    (super-instantiate())))
>
>I'm add your define for the event, but i don't understand hom i can use it,
>for example i'm click with the left button, how can call the function
>(on-event e) ? I'm define (define mouse (make-object mouse-event%
>'left-down)) ? I'm not understand how catch and use the mouse event when i'm
>use it, the function not run
>
>thanks you by advance for your answers
>----- Original Message -----
>From: "Katsmall the Wise" <kela_bit at netvision.net.il>
>To: "The Computer Man" <thecomputerman at wanadoo.fr>
>Cc: <plt-scheme at qua.cs.brown.edu>
>Sent: Sunday, April 13, 2003 9:23 AM
>Subject: Re: [plt-scheme] Mouse and Canvas Object
>
>
>  
>
>>You should use
>>(define my-canvas%
>>  (class canvas%
>>    (define/override (on-event e)
>>      ; here you should check what event-type e is, what the buttons
>>are, and such...
>>      )))
>>
>>e is of type mouse-event%.
>>Look for it n the Help Desk.
>>Good luck!
>>
>>Katsmall the Wise
>>
>>The Computer Man wrote:
>>
>>    
>>
>>> For list-related administrative tasks:
>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>>Hello,
>>>
>>>I have a problem with the management of the mouse into object, I would
>>>      
>>>
>like
>  
>
>>>to know if there is a documentation, or if somebody could explain me the
>>>operation of the mouse into object, how it is known that there were a
>>>clic...?
>>>
>>>Thank you by advance for your answers
>>>
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20030413/3d8860cf/attachment.html>

Posted on the users mailing list.