Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-19 Thread Dmitry Pavlov

Matthew,


Second thought was to check the latest snapshot (d0d85b2, commit in
racket/racket made ~3h later than yours in racket/gui). That did not
work, too -- the commit of interest is not included into the snapshot.

That should have worked, and it looks to me like the change is included
in the d0d85b2 snapshots. (I downloaded a source distribution from both
the Utah and NWU sites to check.) Can you say more about which one you
downloaded and why the change seems to be missing?


Oh, it has turned out that I executed the wrong (old) installer instead 
of the snapshot's.
I got it working, thank you! I am sorry for wasting your time on 
checking the snapshot.


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.


Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-19 Thread Matthew Flatt
At Thu, 19 May 2016 14:30:08 +0300, Dmitry Pavlov wrote:
> Thank you so much. I am eager to try this new feature. I can not figure 
> a good way to set it up on my machine.
> I have Racket 6.5 release. My first thought was "let me try this new 
> package system":
> 
> $ sudo raco pkg update gui
> Inferred package scope: installation
> Resolving "gui" via https://download.racket-lang.org/releases/6.5/catalog/
> Resolving "gui-lib" via 
> https://download.racket-lang.org/releases/6.5/catalog/
> Resolving "gui-doc" via 
> https://download.racket-lang.org/releases/6.5/catalog/
> No updates available

A release is configured with a release-specific catalog before the main
one:

 laptop% bin/raco pkg config catalogs
 https://download.racket-lang.org/releases/6.5/catalog/
 https://pkgs.racket-lang.org
 https://planet-compats.racket-lang.org

So, you could specify the catalog that always has the latest:

 laptop% bin/raco pkg update --catalog https://pkgs.racket-lang.org gui-lib

Unfortunately, it's not going to work in this case:

 Inferred package scope: installation
 Resolving "gui-lib" via https://pkgs.racket-lang.org
 Updating:
  gui-lib
 Downloading repository git://github.com/racket/gui/?path=gui-lib
 The following out-of-date packages are listed as dependencies of gui-lib:
base (have 6.5, need 6.5.0.2)
 Would you like to update these dependencies? [Y/n/a/c/?] n

The problem is that the latest "gui-lib" already uses base features
that are not in v6.5.

> Second thought was to check the latest snapshot (d0d85b2, commit in 
> racket/racket made ~3h later than yours in racket/gui). That did not 
> work, too -- the commit of interest is not included into the snapshot.

That should have worked, and it looks to me like the change is included
in the d0d85b2 snapshots. (I downloaded a source distribution from both
the Utah and NWU sites to check.) Can you say more about which one you
downloaded and why the change seems to be missing?

-- 
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.


Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-19 Thread Dmitry Pavlov

Matthew,

On 05/19/2016 12:33 AM, Matthew Flatt wrote:

There's not a good way to do this outside the primitives, because it's
a matter of selecting the right GTK widgets.

I've added 'hide-hscroll and 'hide-vscroll, which are like 'hscroll and
'vscroll (i.e., they allow the panel's size to be smaller than its
content) but never show the corresponding scrollbar.
Thank you so much. I am eager to try this new feature. I can not figure 
a good way to set it up on my machine.
I have Racket 6.5 release. My first thought was "let me try this new 
package system":


$ sudo raco pkg update gui
Inferred package scope: installation
Resolving "gui" via https://download.racket-lang.org/releases/6.5/catalog/
Resolving "gui-lib" via 
https://download.racket-lang.org/releases/6.5/catalog/
Resolving "gui-doc" via 
https://download.racket-lang.org/releases/6.5/catalog/

No updates available

Second thought was to check the latest snapshot (d0d85b2, commit in 
racket/racket made ~3h later than yours in racket/gui). That did not 
work, too -- the commit of interest is not included into the snapshot.


What would you recommend? Is there a catalog similar to Debian 
"unstable" repo that I can sync to?


Best regards,

Dmitry





At Wed, 18 May 2016 23:37:02 +0300, Dmitry Pavlov wrote:

Matthew,

  > One possible fix is to add the 'hscroll style to the horizontal panel.
  > That change moves the program into "defined behavior" territory, since
  > a scrolling panel allows its content to be wider than itself.

I just tried that and I see that it shows a scrollbar under the
panel that I would not like the user to see. Is there a way to hide it?


That is indeed in "undefined behavior" territory for the GUI library,
because `racket/gui` doesn't pin down what happens when widgets overlap
(including panels and buttons).

OK, but the panel with 'hscroll somehow handles the controls that go
outside of the panel's geometry, can I do the same manually?
Or the scrolling mechanism is hidden in a primitive?


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.


--
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.


Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-18 Thread Matthew Flatt
There's not a good way to do this outside the primitives, because it's
a matter of selecting the right GTK widgets.

I've added 'hide-hscroll and 'hide-vscroll, which are like 'hscroll and
'vscroll (i.e., they allow the panel's size to be smaller than its
content) but never show the corresponding scrollbar.

At Wed, 18 May 2016 23:37:02 +0300, Dmitry Pavlov wrote:
> Matthew,
> 
>  > One possible fix is to add the 'hscroll style to the horizontal panel.
>  > That change moves the program into "defined behavior" territory, since
>  > a scrolling panel allows its content to be wider than itself.
> 
> I just tried that and I see that it shows a scrollbar under the
> panel that I would not like the user to see. Is there a way to hide it?
> 
> > That is indeed in "undefined behavior" territory for the GUI library,
> > because `racket/gui` doesn't pin down what happens when widgets overlap
> > (including panels and buttons).
> 
> OK, but the panel with 'hscroll somehow handles the controls that go
> outside of the panel's geometry, can I do the same manually?
> Or the scrolling mechanism is hidden in a primitive?
> 
> 
> 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.

-- 
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.


Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-18 Thread Dmitry Pavlov

Matthew,

> One possible fix is to add the 'hscroll style to the horizontal panel.
> That change moves the program into "defined behavior" territory, since
> a scrolling panel allows its content to be wider than itself.

I just tried that and I see that it shows a scrollbar under the
panel that I would not like the user to see. Is there a way to hide it?


That is indeed in "undefined behavior" territory for the GUI library,
because `racket/gui` doesn't pin down what happens when widgets overlap
(including panels and buttons).


OK, but the panel with 'hscroll somehow handles the controls that go
outside of the panel's geometry, can I do the same manually?
Or the scrolling mechanism is hidden in a primitive?


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.


Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-18 Thread Matthew Flatt
That is indeed in "undefined behavior" territory for the GUI library,
because `racket/gui` doesn't pin down what happens when widgets overlap
(including panels and buttons).

One possible fix is to add the 'hscroll style to the horizontal panel.
That change moves the program into "defined behavior" territory, since
a scrolling panel allows its content to be wider than itself.

At Wed, 18 May 2016 20:53:53 +0300, Dmitry Pavlov wrote:
> 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.

-- 
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.


[racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-18 Thread Dmitry Pavlov

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.