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

SliderInt support for stb_sprintf() comma value #3604

Closed
metarutaiga opened this issue Nov 19, 2020 · 2 comments
Closed

SliderInt support for stb_sprintf() comma value #3604

metarutaiga opened this issue Nov 19, 2020 · 2 comments

Comments

@metarutaiga
Copy link

metarutaiga commented Nov 19, 2020

Version/Branch of Dear ImGui:

Version: 1.79
Branch: docking
Define: IMGUI_USE_STB_SPRINTF

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_osx.mm + imgui_impl_metal.mm
Compiler: Apple clang version 12.0.0 (clang-1200.0.32.27)
Operating System: macOS 11.0.1

My Issue/Question:

I try to print a comma value, but it would be get wrong value when sliding.
It seem a problem in ImAtoi that don't support comma.

Screenshots/Video

A
B

Standalone, minimal, complete and verifiable example:

ImGui::SliderInt("Value", &value, 100000, 10000000, "%'d");
rokups added a commit to rokups/imgui that referenced this issue Nov 19, 2020
… RoundScalarWithFormatT() as they break ImAtof()/ImAtoi() and cause Drag*()/Slider*() widgets display incorrect values. Fixes ocornut#3604.
rokups added a commit to rokups/imgui that referenced this issue Nov 19, 2020
… RoundScalarWithFormatT() as they break ImAtof()/ImAtoi() and cause Drag*()/Slider*() widgets display incorrect values. Fixes ocornut#3604.
@ocornut ocornut changed the title SliderInt don't support for a comma value SliderInt support for stb_sprintf() comma value Nov 19, 2020
@metarutaiga
Copy link
Author

metarutaiga commented Nov 20, 2020

In addition, the ' flag in printf is the standard POSIX 2008.
In my test, MSVC is still unsupported it currently.

How to format a number from 1123456789 to 1,123,456,789 in C?

ocornut pushed a commit that referenced this issue Mar 5, 2021
… RoundScalarWithFormatT() as they break ImAtof()/ImAtoi() and cause Drag*()/Slider*() widgets display incorrect values. (#3604)

Widgets: Sliders: Fix a bug where numbers after format specifier (eg. %d123) would cause RoundScalarWithFormatT() return incorrect value.
ocornut added a commit that referenced this issue Mar 5, 2021
…impler loops, will also be used for ImStrv branch. (8ee77f1) (#3604)

Widgets: Sliders: Fix a bug where numbers after format specifier (eg. %d123) would cause RoundScalarWithFormatT() return incorrect value.
@ocornut
Copy link
Owner

ocornut commented Mar 5, 2021

This has now been fixed by 8ee77f1 and e842b19.

@ocornut ocornut closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants