-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Using localized decimal point in InputTextFilterCharacter #2278
Comments
Hello, Which I appreciate the idea I think this is going to be a slowly never-ending pit of adjustment and side effects in other parts of the code, the responsability of which I would rather avoid. Can't you set the locale to something English-based for the duration of the imgui code? |
I just thought I share this solution I came across. I will leave a reply here, once I found any unwanted side-effects. I don’t set the locale manually since it is done by windows/msvc?
…________________________________
Von: omar <notifications@github.com>
Gesendet: Sunday, January 13, 2019 7:25:30 PM
An: ocornut/imgui
Cc: Johannes Witt; Author
Betreff: Re: [ocornut/imgui] Using localized decimal point in InputTextFilterCharacter (#2278)
Hello,
Which I appreciate the idea I think this is going to be a slowly never-ending pit of adjustment and side effects in other parts of the code, the responsability of which I would rather avoid.
Can't you set the locale to something English-based for the duration of the imgui code?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#2278 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ANh1ofpgPJ6E2XfrGLmafK3VrDO_Yc9Uks5vC3oagaJpZM4Z9SA4>.
|
I have to admit I never realized printf/scanf could have been affected by locale so this comes as a surprise. I’ll have to think about it!
|
…ented. (#2278) + Misc doc update. Doc: Mention IMGUI_VERSION_NUM in recent api breaking changes + textwrap some demo code.
Hello, I finally looked at this today. Honestly I would advise switching (even temporarily) back to the default "C" locale while using dear imgui functions, but since you state those changes may be enough to get by (and a quick inspection here seemed to confirm it), I added suitable code to perform that override without modifying imgui source codes. I'm not however calling Instead you can now add this in your app code:
Please note that I don't expect to support that more widely. I think it has potential to complexify library code and betray the expectation of lots of user code to so. People may have entire data parsers assuming dot as a separator, etc. Consider the general not-very-internationalization-friendly stance of dear imgui I don't imagine this evolving. I don't know if said project is still active with the Cheers. |
Hello, Version: v1.89 WIP Question / Suggestion: My current solution is the line: Complete code part:
So far this is working out great for both user types (german and english keyboard). @ocornut |
FYI following discussions in #6719 I have moved |
FYI in today's change the storage of |
Version/Branch of Dear ImGui:
Version: 1.64
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui-sfml
Operating System: Windows 10
My Issue/Question:
I use the InputDouble on a German machine. In Germany the numeric point is a comma. When I use the ImGui::InputDouble(...) then there is the ImGuiInputTextFlags_CharsScientific apllied. The InputTextFilterCharacter, then checks for the entered char, but discards a legal comma. It also appears that inserting a point does not work since it is not interpreted as decimal point by the sscanf function.
Proposal
If would use the (unsigned int)*localeconv()->decimal_point instead, then the correct decimal point would be automatically selected.
The text was updated successfully, but these errors were encountered: