4 Extending the Existing DrRacket Classes

▼ |  | Dr Racket Plugins

1 | Implementing Dr Racket Plugins
2 | Adding Languages to Dr Racket
3 | Creating New Kinds of Dr Racket Frames
4 | Extending the Existing Dr Racket Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | Language-Specific Capabilities
8 | Check Syntax
9 | Cooperating with Background Check Syntax
10 | Teaching Languages
11 | Signatures
12 | drracket: get/ extend
13 | drracket: unit
14 | drracket: language
15 | drracket: language-configuration
16 | drracket: debug
17 | drracket: rep
18 | drracket: frame
19 | drracket: help-desk
20 | drracket: eval
21 | drracket: modes
22 | drracket: module-language-tools
23 | drracket: module-language
24 | drracket: tracing
25 | Backwards Compatibility
| Index

top ← prev up next →

### 4`` Extending the Existing DrRacket Classes

Each of the names:

- drracket:get/extend:extend-interactions-text

- drracket:get/extend:extend-definitions-text

- drracket:get/extend:extend-interactions-canvas

- drracket:get/extend:extend-definitions-canvas

- drracket:get/extend:extend-unit-frame

- drracket:get/extend:extend-tab

is bound to an extender function. In order to change the behavior of DrRacket, you can derive new classes from the standard classes for the frame, texts, canvases. Each extender accepts a function as input. The function it accepts must take a class as its argument and return a classes derived from that class as its result. For example:

> (drracket:get/extend:extend-interactions-text
> (lambda (super%)
> (class super%
> (define/public (method1 x) ...)
> (super-new))))

extends the interactions text class with a method named method1.
top ← prev up next →