[plt-scheme] Embarrasingly basic GUI question

From: Andrew Reilly (andrew-scheme at areilly.bpc-users.org)
Date: Tue Aug 11 01:28:33 EDT 2009

Hi Eli,

Thanks for answering so promptly!

On Tue, Aug 11, 2009 at 12:39:10AM -0400, Eli Barzilay wrote:
> Looks like what you're missing is a (yield 'wait).

Yes, that looks like the main part of the puzzle.

Now I need to figure out how to attach a callback to (or
otherwise notice) the window being closed.  The yield isn't
exiting when my window closes because I have a timer active.

> The main thing to learn is that an "eventspace" is basically wrapping
> a single gui thread, and something like (yield 'wait) will wait until
> the thread has nothing else to do (no more windows etc).  Based on
> this you can see why you need two eventspaces if you want two
> independent gui elements, and you can also see why it's bad to have
> threads do work in a gui code (you're likely to get race conditions)
> and instead a utility thread uses `queue-callback' to register a thunk
> that the main thread will use to do the work in the usual
> gui-serializable way.

Yes.  I need to study eventspaces more thoroughly.  I don't
think that I need queue-callback yet, thankfully.

> IIRC, the framework's dialogs are not doing anything more than the
> basic mred functions (eg, `get-file').

Thanks!  I was scanning the "Windowing Classes" hierarchy
backwards and forwards and hadn't noticed the "Windowing
Functions" section that followed...



Posted on the users mailing list.