revise buttons

dev-srcloc
Matthew Butterick 8 years ago
parent c0f33dac9a
commit 451c006d40

@ -1,15 +1,21 @@
#lang br
(require br/drracket)
(require racket/draw)
(define (button-func drr-window)
(define expr-string "@$ $@")
(define editor (send drr-window get-definitions-text))
(send editor begin-edit-sequence)
(send editor insert expr-string)
(send editor end-edit-sequence)
(define pos (send editor get-end-position))
(send editor set-position (- pos (/ (string-length expr-string) 2))))
(define pos (send editor get-start-position))
(send editor set-position (- pos 3)))
(define our-jsonic-button
(list
"Insert expression"
(make-object bitmap% 16 16)
button-func
#f))
(define button-list
(list (make-drracket-button "Insert expression" button-func)))
(provide button-list)
(define button-list (list our-jsonic-button))

Loading…
Cancel
Save