Ticket #249 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 years ago

plai gc-gui.ss: move frame show to after panel creation

Reported by: robby Owned by: plai
Priority: minor Milestone:
Component: plai/plai.plt Keywords:
Cc: Version: (1 12)
Racket Version: 4.2.3


If the line

(send frame show true)

in private/gc-gui.ss moves to after the definition of the private field "heap" then the gui looks a bit smoother (and opens faster).

Change History

Changed 8 years ago by robby

Also related, adding

(new grow-box-spacer-pane% [parent frame])

just before the call to the show method makes it look better on a mac (and won't change things elsewhere)

Changed 8 years ago by robby

In addition to the other comments, I've also made some edits so that resizing the window does something good. Here's my revised file.

#lang scheme/gui
(provide heap-viz%)

(define row-size 10)

(define heap-viz<%> (interface () update-view))

(define font (make-object font% 14 'default))

(define dummy-string "undefined")

(define cell%

(class message%

(init-field [value 'undefined])
(inherit set-label)
(define/public (set-value v)

(set! value v)
(set-label (format "~a" v)))

(define/public (get-value) value)
(super-new [label dummy-string])
(set-label (format "~a" value))))

(define heap-viz%

(class* object% (heap-viz<%>)

(init-field heap-vec)

(define size (vector-length heap-vec))

(define frame

(parameterize ([current-eventspace (make-eventspace)])

(new frame% [width 320] [height 240] [label "Heap"])))

(define v-pane (new vertical-pane% [parent frame]))

(define top (new horizontal-pane% [parent v-pane] [alignment '(center center)]))

(define top-labels

(build-list (add1 row-size) (lambda (i) (new message% [parent top] [label dummy-string] [stretchable-width #t]))))

(send (first top-labels) set-label "")

(lambda (m i) (send m set-label (number->string i)))
(rest top-labels)
(build-list row-size (λ (v) v)))

(define h-panes


(quotient (+ row-size size -1) row-size)
(lambda (i)

(let* ([pane (new horizontal-pane% [parent v-pane] [stretchable-width #t])]

[header (new message% [parent pane] [label dummy-string] [stretchable-width #t])])

(send header set-label (number->string (* i row-size)))

(define heap

(build-vector size (lambda (i) (new cell%

[parent (vector-ref h-panes (quotient i row-size))]
[stretchable-width #t]))))

(new grow-box-spacer-pane% [parent frame])
(send frame show true)

(define/public (update-view #:location loc)

(send (vector-ref heap loc) set-value (vector-ref heap-vec loc)))


Changed 8 years ago by plai

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.