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

Do no draw uiSlider value on unix systems to match darwin & windows. #380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szanni
Copy link

@szanni szanni commented May 31, 2018

As can be seen in the example screenshots provided in the README, the slider on Unix platforms looks somewhat different. It draws the current value above the slider. This commit fixes that - makes all platforms look the same.

@mischnic
Copy link
Contributor

mischnic commented May 31, 2018

the slider on Unix platforms looks somewhat different

Maybe this could be added to windows and macos and exposed in the constructor?

@andlabs
Copy link
Owner

andlabs commented May 31, 2018

I can consider taking this if on GTK+ a tooltip is used instead. This is how it works on Windows; I forget if it's how it works on Mac.

@mischnic
Copy link
Contributor

I forget if it's how it works on Mac.

On macOS there is no indication whatsoever.

@szanni
Copy link
Author

szanni commented Jun 1, 2018

Exactly, macOS has no indication whatsoever.

So to make an app truly cross platform the library user has to provide some other means of conveying the current value to the app user.
Or libui has to provide some default display mechanism for macOS, which IMO does not really make sense.

@mischnic
Copy link
Contributor

mischnic commented Jun 1, 2018

This would show a tooltip with the value after hovering over the knob.

diff --git a/darwin/slider.m b/darwin/slider.m
index 6f5c5a76..8705a454 100644
--- a/darwin/slider.m
+++ b/darwin/slider.m
@@ -58,6 +58,7 @@ struct uiSlider {

        s = (uiSlider *) uiprivMapGet(self->sliders, sender);
        (*(s->onChanged))(s, s->onChangedData);
+       [s->slider setToolTip:[NSString stringWithFormat:@"%ld",[s->slider integerValue]]];
 }

 - (void)registerSlider:(uiSlider *)s

But more generally: What if the slider value isn't really what the user uses? Then the slider tooltip would be wrong.

@szanni
Copy link
Author

szanni commented Sep 26, 2018

I just opened a new pr with a slightly different approach with default tooltips on all platforms and enable/disable functions to leave the choice up to the user in #424

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.

3 participants