[plt-scheme] Trouble with GUI

From: Arctic Fidelity (af at aaronhsu.com)
Date: Fri Oct 15 09:46:13 EDT 2004

Alright, this is the first "real" project I have done in PLT, and I'm 
really enjoying it. The editor in Dr Scheme has made things a 
breeze. :-) I have now successfully set up a nice looking GUI which 
is working perfectly as far as actually showing up and stuff, but now 
I need to interface it with the back-end I have created.

This is where I get stuck. I'm a bit confused on the callback 
procedures and such. I can interface with the text-field I have 
created easily enough, and it's easy for me to handle that, but what 
I am having troubles with is that this is not how I want to work with 
this. 

I have two text fields on this project, one I want to be a disabled 
field which I can update through buttons which are pushed, as well 
as a very limited subset of key events. I do not want this field to be 
editable. I then want to have an editable field which works as a 
"output buffer" that I can add to as data is processed. 

I think I have the ouput buffer okay, but what's getting me is 
processing the keys. I understand how I would process the buttons, 
but how would I capture the key events from anywhere but the 
output field, and then according to what key was pressed, update 
my disabled text-field appropriately.

The plan I had was to create a procedure for the main window 
which would take the input from the keys, and process it from there. 
However, I cannot seem to figure out how to use "on-subwindow-
char" or how to change what happens with that, as the frame% has 
nowhere that I can specify a callback procedure. 

I understand why this is so, but then how do I implement this? I'm 
just really confused right now, and reading the manuals has only 
gotten me to this point. So far, it seems that I need to use a (send 
main-window on-subwindow-char blah blah) of some kind to send a 
key event to the main window and process it through it's callback 
procedure; editing the callback procedure is confusing me.

Is this the best way to implement this? I am looking for small and 
clean here.

Thanks for all your help,

- Aaron Hsu <af at aaronhsu.com>




Posted on the users mailing list.