[plt-scheme] Parameterize and the GUI

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Mon Aug 10 19:41:48 EDT 2009

Synx,

The parameterize macro sets a parameter for an intermediate part of
computation.  If you want to set it persistently instead, just apply
the parameter as a setter function like so:

(foo something-new)

That will set the parameter foo to the value something-new for the
duration of the current thread (at least until something else changes
it again).  To set it for a GUI callback thread, just make sure to
call it from inside any GUI callback.

Carl Eastlund

On Mon, Aug 10, 2009 at 7:19 PM, Synx<plt at synx.us.to> wrote:
>
> Anyone know how to change parameters, while using the GUI? Because when
> I try to do it I'm like...
>
> (parameterize
>  ((foo something-new))
>  (um...)
>  (kill all the GUI windows)
>  (shut down everything)
>  (start up a new GUI))
>
> Or else I just say (foo something-new) and treat the parameter like a
> global. I'm not sure (parameterize) can be used right with an
> asynchronous event loop type framework. You could nest event loops, but...
>
> Maybe I'm just not thinking with the right structure. How would you
> structure a GUI program, where you called something that never returned
> but put the GUI into a different state based on the new parameter settings?


Posted on the users mailing list.