[plt-scheme] Embarrasingly basic GUI question
Hi there,
I'm not much of a GUI coder: I've managed to avoid it for thirty
years so far, but I felt comfortable enough with PLT scheme (and
the DrScheme environment) that I thought I'd give it a go.
Things seemed to be going swimmingly. My GUI is a control-panel
for some functionality that lives at the end of a TCP session.
I've got the data model and IO sorted. I've got a frame% filled
with horizontal and vertical panels, each with collections of
message%s, button%s and slider%s and what-not. Lovely!
But I can't find a "main-loop" function or method that I'd
assumed would be there. My "GUI" function gets to the (send
frame show #t) and just falls off the end. The gui stays there,
on the screen, but my data model and communications protocol
have cleaned themselves up and gone home, so when I touch one of
the GUI widgets, and the callback tries to write to the control
port, the port is closed.
I tried to build my own wait-until-exit function, with a channel
(blocking on a channel-get until a channel-put is triggered by
a widget callback), but that seems to hang the whole window,
including the window-manager close button. Not all that
surprising, but it just emphasises the main lesson:
Clearly I'm missing some bigger-picture information about how to
handle exit conditions, window-closes, and so on. I've looked
all through the Graphics Toolkit manual, but can't see it.
Can someone please point me to a hello-world #lang scheme/gui
example that includes close/quit functionality?
Also: I'm going to need a File->open... dialog at some stage.
Should I be using the "PLT GUI Application Framework" instead of
the "PLT Graphics Toolkit"?
Cheers,
--
Andrew