GUIServer Bug: Scrolled canvas isn't repainted.

Started by oofoe, December 07, 2015, 10:28:34 AM

Previous topic - Next topic

oofoe

Hi!



I'd like to report a bug with canvases when used with scroll bars. If you run the following code, it creates a 2048x2048 canvas, then places it into a scrolled pane. You can scroll the canvas, but it will not repaint when you stop scrolling. Even forcing a gs:update (click on canvas) will not repaint it.



However, changing the window size will, which proves that scrollable large canvases should be doable, just maybe an event isn't getting propagated correctly on the Java side?



Thanks very much!


(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
(gs:init)

(define (canvas-unclick)
  "( --) Handler for mouse button release."

  (gs:update)) ;; Note that this doesn't work.

(define (layout)
  "( --) Layout GUI."

  (gs:canvas 'Canvas)
  (gs:mouse-released 'Canvas 'canvas-unclick)

  (gs:panel 'Stretcher 2048 2048)
  (gs:set-border-layout 'Stretcher)
  (gs:add-to 'Stretcher 'Canvas "center")

  (gs:scroll-pane 'Workspace 'Stretcher)

  (gs:frame 'F  0 0  800 600  "Scrolling Canvas Test")
  (gs:add-to 'F 'Workspace)

  (gs:fill-rect 'shape   50  50  500 500  '(1 1 0))
  (gs:fill-rect 'shape  250 250  500 500  '(0 1 0))
  (gs:fill-rect 'shape  500 500  500 500  '(0 1 1))

  (gs:set-visible 'F true))

(layout)
(gs:listen)
Testing can show the presence of bugs, but not their absence.

Lutz

#1
guiserver.jar version 1.65 now correctly forces updates of a gs:canvas in a gs:scroll-pane when scrolling.



guiserver.jar v.1.65 can be downloaded here:



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/





ps: (gs:mouse-released 'Canvas 'canvas-unclick) is not required, scrolling will automatically force update of the canvas.

oofoe

#2
Christmas is early -- this works great!



The canvas-unclick function was just to show that I had tried to do a gs:update and it hadn't worked either. I wanted to give you a good example to test with.



Thanks very much!
Testing can show the presence of bugs, but not their absence.