Closed spdegabrielle closed 3 years ago
This weeks quickscript is a classic from the quickscript-extra collection.
quickscript-extra
In addition to keybindings, quickscripts can also add new custom menu's to DrRacket. This script is a demo of that functionality.
#lang racket/base (require racket/gui/base racket/class quickscript) (script-help-string "(Example) Shows how to dynamically add a menu to DrRacket.") (define-script add-menu #:label "Add menu" #:menu-path ("E&xamples") (λ (str #:frame fr) (define menu-bar (send fr get-menu-bar)) (define menu (new menu% [parent menu-bar] [label "M&y Menu"])) (new menu-item% [parent menu] [label "&Remove me"] [callback (λ _ (send menu delete))]) (define count 0) (new menu-item% [parent menu] [label "&Count me"] [callback (λ _ (set! count (add1 count)) (message-box "Count" (string-append "Count: " (number->string count))) )]) #f))
Installation: you can paste this into a new script - but check out the quickscript-extra collection for more goodies.
In DrRacket, in File|Package manager|Source, enter quickscript-extra.
File|Package manager|Source
Or, on the command line, type: raco pkg install quickscript-extra.
raco pkg install quickscript-extra
If DrRacket is already running, click on Scripts|Manage scripts|Compile scripts and reload menu.
Scripts|Manage scripts|Compile scripts and reload menu
Thanks.
This weeks quickscript is a classic from the
quickscript-extra
collection.In addition to keybindings, quickscripts can also add new custom menu's to DrRacket. This script is a demo of that functionality.
Installation: you can paste this into a new script - but check out the quickscript-extra collection for more goodies.
In DrRacket, in
File|Package manager|Source
, enterquickscript-extra
.Or, on the command line, type:
raco pkg install quickscript-extra
.If DrRacket is already running, click on
Scripts|Manage scripts|Compile scripts and reload menu
.