[plt-scheme] DrScheme, detecting frame activation and deactivation, where should I look next?

From: Grant Rettke (grettke at acm.org)
Date: Thu May 24 00:10:01 EDT 2007

Here is how it ended up looking.

(define activate-frame-mixin%
        (mixin (top-level-window<%>) ()
          (define not-showed-on #t)
          (define not-showed-off #t)
          (define/override (on-activate active?)
            (super on-activate active?)
            (cond [(and active? not-showed-on)
                   (message-box "" "Activated") (set! not-showed-on #f)]
                  [(and (not active?) not-showed-off)
                   (message-box "" "Deactivated") (set! not-showed-off #f)]
                  [else void]))

Based on what I read in:


I thought that maybe that class should mixin with
drscheme:unit:frame<%>. I tried that and it did work fine, but I
imagine that the more adaptable route is mixin with
top-level-window<%> because that is where the method is defined and
the drscheme frame will probably always implement that interface.

On 5/15/07, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Mon, 14 May 2007 23:05:08 -0500, "Grant Rettke" wrote:
> > My goal is to detect DrScheme frame activation and deactivation.
> You'll want to override the `on-activate' method in the DrScheme frame.
> It will go something like this, I think:
>  (define (activate-frame-mixin %)
>    (class %
>      (define-override (on-activate? active?)
>        ...
>        (super on-activate? active?))
>      (super-new)))
>  (drscheme:get/extend:extend-unit-frame activate-frame-mixin)
> Matthew

Posted on the users mailing list.