Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%button layout/sizing bug #291

Open
paschlie opened this issue Mar 22, 2023 · 0 comments
Open

%button layout/sizing bug #291

paschlie opened this issue Mar 22, 2023 · 0 comments

Comments

@paschlie
Copy link

paschlie commented Mar 22, 2023

The following demonstrates a subtle %button layout/sizing bug, which results in multi-line %button's being wider, and given proportionately less horizontal margin, than its single-line counterpart.

(when run under macos 13.2.1)...


#lang racket/gui
(define dialog (instantiate dialog% ("X")))

(define hpanel-1 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-1] [label "X"]) ; much wider than it need be
(new button% [parent hpanel-1] [label "X"])
(new button% [parent hpanel-1] [label "X"])

(define hpanel-2 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-2] [label "XXXX"]) ; max text prior to stretching
(new button% [parent hpanel-2] [label "XXXX"])
(new button% [parent hpanel-2] [label "XXXX"])

(define hpanel-4 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-4] [label "X\nX"]) ; wider with less margin
(new button% [parent hpanel-4] [label "X\nX"])
(new button% [parent hpanel-4] [label "X\nX"])

(define hpanel-5 (new horizontal-panel% [parent dialog] [horiz-margin 0]))
(new button% [parent hpanel-5] [label "XXXXX\nXXXXX"]) ; max text prior to stretching
(new button% [parent hpanel-5] [label "XXXXX\nXXXXX"])
(new button% [parent hpanel-5] [label "XXXXX\nXXXXX"])

(send dialog show #t)


I personally prefer the less default margin associated with the multi-line %button; but would also strongly prefer their min-width be reduced to being no larger the min-height of the button (for a single line button), and thereby can be as small as required to be square and display a single character (or Nx1 chars for multi-line buttons, and thereby be N x taller than wide); and the horiz-margin around the label be reduced to be only slightly more than apparently allocated for its vert-margin, seemingly being only a few pixels or so (or whatever required to enable the smallest square button to cleanly display a single character).

This is related to the prior feature request #290.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant