Page 1 of 1

GUIServer Bug: Scrolled canvas isn't repainted.

PostPosted: Mon Dec 07, 2015 6:28 pm
by 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!

Code: Select all
(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)

Re: GUIServer Bug: Scrolled canvas isn't repainted.

PostPosted: Fri Dec 11, 2015 12:33 am
by Lutz
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/develo ... nprogress/


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

Re: GUIServer Bug: Scrolled canvas isn't repainted.

PostPosted: Sat Dec 12, 2015 4:02 am
by oofoe
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!