Comments (18)
This seems related, might want to read it. I tried running this code here.
NumberFormat.getInstance(Locale.GERMANY).parse("-5");
NumberFormat.getInstance(Locale.CHINESE).parse("-5");
NumberFormat.getInstance(new Locale("en", "GB")).parse("-5");
NumberFormat.getInstance(new Locale("no", "NO")).parse("-5");
Crashed on the fourth line Unparseable number: "-5"
. (It's the default local set by my computer)
Also it got closed as "Not an Issue" so it's apparently not a bug and is intended behaviour.
from imgui.
Yeah I just tried running my program on a JVM using a different default local and it doesn't crash anymore. So it only crashes depending on what region of the world you are from, lol.
If you can't reproduce the bug, try running the JVM with the arguments -Duser.country=NO -Duser.language=no
. I'm also using Java 9 which might be relevant.
from imgui.
-Duser.country=NO -Duser.language=no
did actually help to reproduce the error, coz I was having no excepetion with negative ns
float dragging field.
Uhm, that's tricky to resolve. Shall we maybe detect and react according to the current locale?
Any tips?
Which was your original locale that provoked the crash?
from imgui.
My original locale is Norwegian no_NO.
I can really give any tips though as I have no idea what roundScalarWithFormat
does or why the parse is necessary. Rounding by converting to string, then back again seems really strange to me (at least that's what I think it is doing).
from imgui.
In a comment, Omar wrote Round to user desired precision based on format string
I'll think about it
In the meanwhile... why the hell does it crash with negative values using Norwegian locale...? lol
Anyway, I just pushed a workaround, DecimalFormat
will always use as locale style.locale
(which is now a var
and default US
)
from imgui.
Don't think I understand Omar's thinking then. I don't see why the way a number is represented has to be tightly coupled with the actual value. If I wanted a slider with steps of 0.001 yet is formatted to only display a single decimal place of precision it should be my choice.
Anyway I got around to trying out the most recent commit (3620dfd) with the workaround and guess what, still broken, lol. The RGB sliders under (Widgets > Basics) causes the same exception to happen when the number of digits go below three due to the extra padding in front, Unparseable number: " 67"
, Unparseable number: " 4"
.
Would be nice to have locale not tied to US only. If the UI is in another language for example it would be nice having e.g. commas instead of a dot as a decimal separator if you set the locale that way.
from imgui.
I have no idea neither, but I'd guess he has his reasons, I need to check if this makes sense on jvm as well
Anyway, lol, man, what's wrong with norwegian format..
Pull again, dear. This time I also trim the begin of the string
As I said, default it us
, but you can change it. It's style::locale
from imgui.
Ah, thank you. Though of course currently changing locale breaks the library..
I don't know why Norwegian is suppose to use a different minus sign. Also I just noticed I didn't seem to actually post the link in my previous comment that I intended for you to read -_-. Anyway this is what I found, link. In the reply it also links to a page on unicode that list which locales have different minus signs. So Norwegian is there (nb/nn) though it's not the only one using that special minus sign, but also Finnish, Swedish, Italian, etc.
from imgui.
Though of course currently changing local breaks the library..
What do you mean?
Uh, that link revealed to be actually quite important (I myself am italian...)
So, if we solve all the troubles you are having, I guess there is also a good chance we'll solve them also for all the other locales..
from imgui.
What do you mean?
Sorry, locale*.
Change the locale in imgui.style to e.g. Norwegian causes the same issues again. I mean your fix was to set the locale to US so naturally setting it to e.g. Norwegian again will make the unparseable number exception happen again.
from imgui.
I dont get any more exceptions..
I'm parsing now strings with DecimalFormat
, it looks working flawless also for Norwegian locale
Give it a try
from imgui.
Tried commit fd68422 and it still throws the same ParseException as usual.
Just looking at the commit though I see nothing that has really changed except the default locale for everyone is now Norwegian instead of US.
from imgui.
Shit, that was unwanted :p
Anyway, I dont get why I dont get anymore the exception..
I tried passing -Duser.country=NO -Duser.language=no
to JVM args..
However, I can still reproduce with
val dec = DecimalFormat().apply {
decimalFormatSymbols = DecimalFormatSymbols(Locale("no", "NO"))
}
dec.parse("-5")
So, let's face the problem from another point of view, let's substitute the old minus with the new out
Give me good news, man ^^
from imgui.
Sure thing! Good news it now works if you set imgui locale to Norwegian!
Bad news? Every other locale now breaks with the same exception due to the new minus sign, including the default US locale.
from imgui.
Ok, then let's switch it only given on the style.locale
Anyway, I'm going crazy.
You can easily do it and test on your machine, since you can reproduce it easily.
Do you mind working on it directly? :)
Ps: tried to send you an invite, but apparently there is no result for @chrjen
You’ll only be able to find a GitHub user by their email address if they’ve chosen to list it publicly. Otherwise, use their username instead.
from imgui.
from imgui.
Well I can always try to help. Don't know why the username doesn't work. Also don't really know Kotlin, but a solution in Java shouldn't be very hard to translate into Kontlin, right?
from imgui.
If needed, chrjen could join lwjgl slack and message you there
Also, as he prefers
Well I can always try to help. Don't know why the username doesn't work.
Try to send me your email, here or on elect86 gmail
Also don't really know Kotlin, but a solution in Java shouldn't be very hard to translate into Kontlin, right?
Right and then you'll love it and you are gonna switch everything to Kotlin :)
from imgui.
Related Issues (20)
- Branch 1.80 WIP available for testing HOT 3
- When I open a menu and click the mouse button on the other space (not on opening windows), program crash! HOT 1
- ./gradlew eclipse does not see the link HOT 1
- Node editors (extension) with kotlin imgui HOT 8
- Gradle unable to resolve imgui dependencies HOT 9
- Example Log doesn't display any text unless a filter is applied HOT 1
- is jdk8-snapshot doesnt work anymore? HOT 1
- Shaders do not compile on M1 (macOS 11.4) HOT 3
- Methods need unecessary parameters when used in java HOT 3
- Some clear, modern example would help
- Unable to load ForwardDeclarationsKt when using Java modules HOT 2
- Use of `static` in package identifier can cause Java interoperability problems HOT 1
- MainMenuBar causes NullPointerException when clicking on free space HOT 1
- `listbox` shows no items
- ImGui can't access static fields and members of org.lwjgl.stb.STBRPRect HOT 3
- Invalid Package name HOT 3
- Index 33619455 out of bounds for length 0 HOT 1
- Documentation still references dl.bintray.com (shutdown nearly two years ago) HOT 1
- Is there a version of imgui for kotlin that works with lwjgl 3.3.1 HOT 7
- Cant get VertexBuffer data from DrawList class HOT 27
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.