[plt-scheme] Trouble with GUI

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 15 10:49:48 EDT 2004

At Fri, 15 Oct 2004 08:46:13 -0500, "Arctic Fidelity" wrote:
> 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 think you're on the right track with `on-subwindow-char'. You need to
derive a subclass of frame% that overrides `on-subwindow-char'.

Your `on-subwindow-char' method will be called for every key event
within the frame; in other words, the overriding method acts like a
callback. Your `on-subwindow-char' method could redirect to an external
callback, though, if that is more convenient for your application.


Posted on the users mailing list.