Hi Alex, Sorry for the late response.
I can confirm the behavior you observed. I don't see anything wrong with your code at first glance, so I'm not sure what the problem is. Neil: Any ideas? Vincent On Sun, 04 Oct 2015 20:36:35 -0500, Alex Harsanyi wrote: > > Hi, > > I posted this question a while ago but I didn't receive any response. I > just retested the code with the current snapshot (6.2.900.17) and it has > the same behavior (bug?). > > Could someone please test this code on their machine and at least > confirm whether it works correctly or not for them? > > If there's a bug in the code below, could you point out what it is? As I > mentioned, the code works fine in 6.1.1 and I cannot find anything that > has changed in this area in version 6.2. > > Note that in recent Racket snapshots snip-canvas% has moved, so, in the > code below, the "(require unstable/gui/snip)" should be replaced with " > (require mrlib/snip-canvas)". > > Thanks, > Alex. > > On Friday, July 24, 2015 at 3:57:13 PM UTC+8, Alex Harsanyi wrote: > > > Hi, > > I'm using the plot-snip function to have interactive plots inside > other GUI elements in my application. This worked fine under Racket > 6.1.1 but fails under Racket 6.2 (bot versions are 64 bit on > Windows). The program below illustrates the problem: the function > `working` creates a plot window using plot-frame. The plot is > resized correctly and the interactive zoom works as expected. The > function `not-working` tries to do the same, but creates the plot > using plot-snip than adds it to a snip canvas. It does essentially > what plot-frame does, without the error checking (I copied out the > functions from he plot package). With this version, the plot is not > resized correctly inside the window and zoom in and out does not > work correctly. Both functions work as expected under Racket version > 6.1.1. > > The program makes use of snip-canvas% which is in unstable/gui, but > as far as I can tell, it has not changed between the two versions. > > Does anyone know what needs to be done to get this to work, or is > this a bug in the plot package? > > Thanks, > Alex. > > #lang racket/gui > (require plot) > (require unstable/gui/snip) > > ;; snip-frame% and make-snip-frame are copied from > ;; C:\Program > Files\Racket\share\pkgs\plot-gui-lib\plot\private\gui\gui.rkt > > (define snip-frame% > (class frame% > (define/override (on-traverse-char event) > (define key-code (send event get-key-code)) > (case key-code > [(escape) (send this show #f)] > [else (super on-traverse-char event)])) > > (super-new))) > > (define (make-snip-frame snip width height label) > (define (make-snip w h) snip) > > (define frame > (new snip-frame% [label label] [width (+ 20 width)] [height (+ 20 > height)])) > > (new snip-canvas% > [parent frame] > [make-snip make-snip] > [horiz-margin 5] [vert-margin 5] > [horizontal-inset 5] [vertical-inset 5]) > > frame) > > ;; This works as expected when resizing the window and zooming the > graph > (define (working) > (parameterize ([plot-width 150] > [plot-height 150] > [plot-x-label #f] > [plot-y-label #f]) > (send (plot-frame (function sqr -2 2)) show #t))) > > ;; This does not > (define (not-working) > (parameterize ([plot-width 150] > [plot-height 150] > [plot-x-label #f] > [plot-y-label #f]) > ;; this is essentially what plot-frame does sans error checking > (send (make-snip-frame (plot-snip (function sqr -2 2)) 200 200 > "hello") show #t))) > > > -- > You received this message because you are subscribed to the Google > Groups "Racket Developers" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to racket-dev+unsubscr...@googlegroups.com. > To post to this group, send email to racket-dev@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-dev/c2517296-2a7a-4e49-b617-21cfac413710%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+unsubscr...@googlegroups.com. To post to this group, send email to racket-dev@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/m21td9vz77.wl-stamourv%40eecs.northwestern.edu. For more options, visit https://groups.google.com/d/optout.