[plt-scheme] Re: Continuous update sliders ...

From: kumar_lista at mac.com (kumar_lista at mac.com)
Date: Sat Jul 5 22:02:15 EDT 2008

I do have the callback function, but here is what happens -

- Between mouse-down and mouse-up the callback doesn't get invoked
and the main event processing seems to pause.

- Upon mouse-up, the callback is invoked as many times as, I think,
the value of the slider changed between mouse-down and mouse-up
in one go.

- Timer events that should have been generated between the mouse-down
and mouse-up don't fire at all. That's how I came to conclude that the
main event loop is paused.

Regards
-Kumar

PS: Platform - Vista Ultimate, running on MacBook Pro.

On 04 Jul 2008, at 8:19 PM, Matthew Flatt wrote:


> At Fri, 04 Jul 2008 11:23:45 +0800, kumar_lista at mac.com wrote:
>
>> Hi,
>>
>> I need some help with the slider% class. Much appreciate any tips.
>>
>> The slider% class behaves modally as it stands - i.e. between  
>> mouse-down
>> and mouse-up on the slider control, the main event loop does not get
>> to run.
>> How do I configure slider% such that I can twiddle it without pausing
>> the
>> main event loop between mouse-down and mouse-up?
>>
>
> Provide a `callback' argument when creating a `slider%'.
>
> The following example illustrates updating a message field
> interactively based on the value of the slider:
>
>  #lang scheme/gui
>
>  (define f (new frame% [label "Hi"]))
>  (define m (new message% [parent f] [label ""]
>                [stretchable-width #t]))
>  (new slider%
>       [label #f] [min-value 0] [max-value 100]
>       [parent f]
>       [callback (lambda (s e)
>                   (send m set-label
>                         (format "Value is ~s" (send s get-value))))])
>  (send f show #t)
>


Posted on the users mailing list.