[plt-scheme] Changing the behavior of the run and debug button in DrScheme

From: Gregory Cooper (greg at cs.brown.edu)
Date: Sun Feb 17 15:37:05 EST 2008

Hi Robert,

Yes.  You'll probably need to define a tool with mixins that extend
various DrScheme classes.

You can use drscheme:get/extend:extend-unit-frame to apply a mixin to
the unit frame (the class for the top-level DrScheme window).  The
mixin can override the execute-callback method, which gets invoked
when the user clicks Run or Debug.

To run your startup code: the unit frame provides a current-tab
method, to which you can send get-ints to get the associated
interactions-text object.  Once you have the interactions-text, you
can send it run-in-evaluation-thread with a thunk containing the code
you want to run.

As far as running shutdown code, you can similarly use
drscheme:get/extend:extend-tab to override enable-evaluation in the
tab.  (I'm pretty sure enable-evaluation gets invoked once all the
definitions have been run, which should give you a suitable hook.
Someone else can correct me if I'm wrong about this.)

For examples of these mechanisms in use, you can look in
collects/mztake/debug-tool.ss.  There may be simpler examples, but
that's where my experience comes from.

Cheers,
Greg

On Feb 17, 2008 2:02 PM, Robert Matovinovic <robert.matovinovic at web.de> wrote:
> Hi,
> is it possible to change the behavior of the run and debug buttons in
> DrScheme via a tool? I implemented a module language to control an external
> program via DDE (this ancient Windows dynamic data exchange). I would like
> to implement an automated connection setup to the external program before
> the program in the definitions window in executed or debugged and an
> automated disconnection afterwards, if that language is chosen. Can anybody
> point me to the right files to look at and what might be a good way to go?
> Thanks a lot.
> Robert
> _________________________________________
> Robert Matovinovic
> Wintererstr. 61
> 79104 Freiburg
> Germany
>
> Tel:    +49 (0)700 6286 0000
> Cell:   +49 (0)171 56 32 330
> email: robert.matovinovic at web.de
>
>
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 18.2756 from 13.02.2008
> Virus news: www.antiviruslab.com
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.