54 lines
1.5 KiB
Markdown
54 lines
1.5 KiB
Markdown
# rackedit
|
|
|
|
`rackedit` opens a simple Racket editor window, optionally with a file. It can be
|
|
used from DrRacket, from a Racket program, or from the Racket command line.
|
|
|
|
The package exports one procedure. With no filename, `rkdt` opens an empty editor:
|
|
|
|
```racket
|
|
(require rackedit)
|
|
|
|
(rkdt)
|
|
```
|
|
|
|
Pass a filename to open an existing file:
|
|
|
|
```racket
|
|
(rkdt "notes.rkt")
|
|
```
|
|
|
|
By default `rkdt` shows the editor and returns immediately. Use `#:wait? #t`
|
|
when execution should continue only after the editor is closed:
|
|
|
|
```racket
|
|
(rkdt "notes.rkt" #:wait? #t)
|
|
```
|
|
|
|
The initial window geometry can be specified with `#:width`, `#:height`, `#:x`,
|
|
and `#:y`. Window positions and sizes are remembered per internal editor number
|
|
and per screen configuration.
|
|
|
|
The frame can be observed or customized with `#:frame-cb`. The callback receives
|
|
an event symbol and the editor frame. It is called at the lifecycle points
|
|
`'before-show`, `'after-show`, `'wait-for-close`, and `'on-close`.
|
|
`'wait-for-close` is emitted only when `#:wait? #t` is used.
|
|
|
|
For example, the window title can be changed before the frame becomes visible:
|
|
|
|
```racket
|
|
(require racket/class
|
|
rackedit)
|
|
|
|
(rkdt "notes.rkt"
|
|
#:frame-cb
|
|
(λ (event frame)
|
|
(when (eq? event 'before-show)
|
|
(send frame set-label "Notes"))))
|
|
```
|
|
|
|
The standard File menu does not contain the Exit/Quit command, so closing one
|
|
editor window does not imply exiting the application that opened it.
|
|
|
|
Full API documentation is included as Scribble documentation in
|
|
`scrbl/rkdt.scrbl`.
|