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

add 'upward style for slider controls #315

Merged
merged 1 commit into from
Dec 17, 2023
Merged

Conversation

mflatt
Copy link
Member

@mflatt mflatt commented Oct 31, 2023

Relevant to #314.

As far as I can tell, a vertical slider in racket/gui is top-to-bottom on all platforms. I don't know or remember why, but I agree that a bottom-to-top slider seems more useful, and probably non-racket/gui programs use bottom-to-top sliders everywhere. The top-to-bottom rendering is also inherent in the macOS control, at least when the range is >= 64.

To add bottom-to-top support without breaking any old programs — just in case — this commit adds an 'upward style option alongside 'horizontal and 'vertical.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 4 files in this pull request and found no issues.

@kengruven
Copy link
Contributor

It looks like GTK is the only backend which tells the native control about the direction. Do Cocoa/Win32 have any corresponding functions? NSSlider, for example, seems to "fill up" from the bottom (but not if there are ticks?), so a vertical slider could look somewhat misleading.

On win32, I see something called TBS_DOWNISLEFT that might be relevant, but I don't have a way to try it out.

(BTW, is there an easy way to build and test a package like racket/gui which has lots of dependencies and dependents in the stdlib? I've looked around a little and haven't found anything yet.)

@mflatt
Copy link
Member Author

mflatt commented Dec 17, 2023

I couldn't find a way to get downward sliders to render right on Mac OS when the range is >= 64, so I added a note to the documentation that rendering could be misleading.

@kengruven — Thanks for the pointer to TBS_DOWNISLEFT, but I wasn't able to get it to do anything on Windows. Maybe I wasn't using that right somehow, but the rendering of sliders doesn't seem to suggest a direction, anyway.

For info on trying out changes to a package like gui-lib, see this section in "Building, Distributing, and Contributing to Racket": https://docs.racket-lang.org/racket-build-guide/contribute.html#%28part._pkg-contribute%29

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 4 files in this pull request and found no issues.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 4 files in this pull request and found no issues.

@mflatt mflatt merged commit 36eec3a into racket:master Dec 17, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants