better buttons
parent
23b3b2e56c
commit
5ce9a0df37
@ -1,18 +1,15 @@
|
|||||||
#lang br
|
#lang br
|
||||||
(require racket/draw)
|
(require br/drracket)
|
||||||
(provide make-button)
|
|
||||||
|
|
||||||
(define label "Insert expression")
|
(define (button-func drr-window)
|
||||||
(define bitmap (make-object bitmap% 16 16))
|
(define expr-string "@$ $@")
|
||||||
(define (callback drr-frame)
|
(define editor (send drr-window get-definitions-text))
|
||||||
(define drr-editor (send drr-frame get-definitions-text))
|
(send editor begin-edit-sequence)
|
||||||
(define block-string "@$ $@")
|
(send editor insert expr-string)
|
||||||
(send drr-editor begin-edit-sequence)
|
(send editor end-edit-sequence)
|
||||||
(send drr-editor insert block-string)
|
(define pos (send editor get-end-position))
|
||||||
(send drr-editor end-edit-sequence)
|
(send editor set-position (- pos (/ (string-length expr-string) 2))))
|
||||||
(define pos (send drr-editor get-end-position))
|
|
||||||
(send drr-editor set-position (- pos (/ (string-length block-string) 2))))
|
|
||||||
(define number 98)
|
|
||||||
|
|
||||||
(define make-button
|
(define button-list
|
||||||
(list (list label bitmap callback number)))
|
(list (make-drracket-button "Insert expression" button-func)))
|
||||||
|
(provide button-list)
|
||||||
|
Loading…
Reference in New Issue