Hello,
I would like to report two GUI issues; I do not know is they are related
or not. I ran against those issues while working on spreadsheet-editor.
The task is to clip a row of buttons (column buttons in my spreadsheet).
Below I reproduce the issue using a simpler configuration than I use in
spreadsheet-editor.
I can reproduce both issues on Linux; on Windows everything is OK. I do
not have an OS X to test on. I have a vague memory that everything was
fine on Linux, too, before Racket moved to GTK+3, but I may be wrong.
1. Clipping of graphics does not work
#lang racket/gui
(define frame
(new frame%
(label "Test")
(width 300)
(height 50)))
(define my-horizontal-panel%
(class horizontal-panel%
(super-new)
(define/override (container-size info)
(values 50 50))
))
(define hpanel-root
(new horizontal-panel%
(parent frame)))
(define hpanel
(new my-horizontal-panel%
(parent hpanel-root)))
(define vpanel
(new vertical-panel%
(parent hpanel-root)
(stretchable-height #f)
(stretchable-width #f)))
(for ((i (in-range 5)))
(new button%
(parent hpanel)
(label "Hey")
(callback
(lambda (button event)
(printf "Hey\n")))))
(void (new button%
(parent vpanel)
(label "Fixed size button 1")))
(void (new button%
(parent vpanel)
(label "Fixed size button 2")))
(send frame show #t)
On Linux, I get: http://imgur.com/AZRji9R
On Windows, I get: http://imgur.com/eKUZ2kk
Obviously, the Linux version did not clip the row of buttons as it is
supposed to. Still, the mouse works only on just that area of the button
that is supposed to be there. That is a bit reassuring until you look at
the second example.
2. Clipping of events does not work in presence of begin-container-sequence
This example is identical to the first one except that the five buttons
are (re)created inside (on-size).
#lang racket/gui
(define frame
(new frame%
(label "Test")
(width 300)
(height 50)))
(define my-horizontal-panel%
(class horizontal-panel%
(super-new)
(define/override (container-size info)
(values 50 50))
(define/override (on-size w h)
(send this begin-container-sequence)
(for ((child (send this get-children)))
(send this delete-child child))
(for ((i (in-range 5)))
(new button%
(parent this)
(label "Hey")
(callback
(lambda (button event)
(printf "Hey\n")))))
(send this end-container-sequence))
))
(define my-super-panel%
(class horizontal-panel%
(super-new)))
(define hpanel-root
(new horizontal-panel%
(parent frame)))
(define hpanel
(new my-horizontal-panel%
(parent hpanel-root)))
(define vpanel
(new vertical-panel%
(parent hpanel-root)
(stretchable-height #f)
(stretchable-width #f)))
(void (new button%
(parent vpanel)
(label "Fixed size button 1")))
(void (new button%
(parent vpanel)
(label "Fixed size button 2")))
(send frame show #t)
The Linux and Windows pictures are the same as for the first example;
but in this one, "Hey" can be pressed anywhere, even in the areas that
are below the big buttons.
I will be grateful for any advice, including possible workarounds. I am
not even sure that my programs are legit and do not just fall victim of
"undefined behavior".
Best regards,
Dmitry
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.