[plt-scheme] Mred - How to know which canvas is active?

From: jack4746 at anonmail.de (jack4746 at anonmail.de)
Date: Sun Nov 5 07:14:42 EST 2006

>Does the combination of `get-top-level-edit-target-window'
>and the `get-edit-target-window' method (of a top-level-window)
>work as expected?

I executed the program, and, in DrScheme's top level, tried both of
your commands. Problem is that i don't know if they do work because
i'm not able to know what they are giving back: how to print the
content of the struct returned?

> (get-top-level-edit-target-window)
#<struct:object:frame%>
> (struct->vector (get-top-level-edit-target-window))
#2(struct:object:frame% ...)
> (struct-accessor-procedure? (get-top-level-edit-target-window))
#f
It seems there is no accessor to print the value? (wired)
(print, write, or display don't do it neither)

Plus: struct documentation says: "When structure printing is
disabled, or when no part of the structure is accessible to the
current inspector, a structure is printed as #<struct:s>."


>I think `get-active-canvas' wouldn't work, because each editor has
>its
>own canvas, and so both canvas would be "active".
>
>Depending on the platform and the relevant callback, I can see why
>`has-focus?' might not work. Menu items on X, for example, move
>the
>focus to the menu temporarily.
>
>Finally, clicking a button might move the focus to the button (on
>some
>platforms). In that case, the only solution that comes to mind is
>to
>override the `on-set-focus' method of the canvases, and explicitly
>track which one most recently had the focus.

Purpose of my application is to work on any platform (windows, mac,
linux), so i'm going to read more about this solution.


Greets.

PS: Matthew, sorry for posting twice: CC function wasn't active.



Posted on the users mailing list.