[racket] how to stop canvas% from refreshing after on-event

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Feb 12 13:40:05 EST 2013

Oh, interesting. It even does it when the mouse movements are not on top of
the frame or the focus is on some other window! I'm not sure about this one.

Robby



On Tue, Feb 12, 2013 at 12:30 PM, Philipp Dikmann <philipp at dikmann.de>wrote:

>  I'm sorry, I should have been more specific – it happens when using a
> gl-enabled canvas (example below).
> I hope that does not turn it into a dragons' den? ;)
>
> Philipp
>
> #lang racket/gui
>
> (require sgl)
>
> (define c%
>   (class canvas%
>     (inherit with-gl-context swap-gl-buffers)
>     (define/override (on-paint)
>       (with-gl-context
>        (lambda ()
>          (gl-clear-color (random) (random) (random) 1)
>          (gl-clear 'color-buffer-bit)
>          (swap-gl-buffers)
>          (gl-flush))))
>     (super-new (style '(gl no-autoclear)))))
>
>
> (define f (new frame% [label ""] [width 100] [height 100]))
> (define c (new c% [parent f]))
> (send f show #t)
>
>
> On 11.02.13 22:39, Robby Findler wrote:
>
> I don't think it does that. The program below, at least for me, doesn't do
> crazy colors when I move the mouse around (it does when resizing, tho).
>
>  Robby
>
>  #lang racket/gui
>
>  (define c%
>   (class canvas%
>     (inherit get-client-size get-dc)
>     (define/override (on-paint)
>       (define-values (w h) (get-client-size))
>       (define dc (get-dc))
>       (define c (make-object color% (random 255) (random 255) (random
> 255)))
>       (send dc set-brush c 'solid)
>       (send dc set-pen "black" 1 'transparent)
>       (send dc draw-ellipse 0 0 w h))
>     (super-new)))
>
>  (define f (new frame% [label ""] [width 100] [height 100]))
> (define c (new c% [parent f]))
> (send f show #t)
>
>
> On Mon, Feb 11, 2013 at 9:41 AM, Philipp Dikmann <philipp at dikmann.de>wrote:
>
>> It appears that the GUI canvas% refreshes itself whenever it receives a
>> mouse-event%.
>> I intend to refresh the canvas at a steady pace (using a timer%) and
>> independently of any mouse-events instead.
>> Is there a reasonable way to suppress the default behavior?
>>
>> Thanks for your time,
>> Philipp
>> ____________________
>>  Racket Users list:
>>  http://lists.racket-lang.org/users
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130212/1508d6bb/attachment.html>

Posted on the users mailing list.