Does numeric_stepper.FormatString = "P0" cause problems in Macs?

I have lots of slider/stepper combos. Some of them deal in units (mm) and some might deal in factors, but I want the user to see percentages.

Gemini suggested using FormatString = “P0” but then told me Mac users might experience problems with inputing numbers directly into the numeric stepper (which is definitely something I want the user to be able to do).

But, of course, LLMs can just make stuff up. So I wanted to verify if anyone had ever had this cause problems for mac users.

Do you have code or graphics? I’m not sure what you mean.

As an example, my code needs a value between 0.0 and 1.0. But I want the user to see values ranging from 0% to 100%. Apparently I can have the stepper have an internal value of 0.0 - 1.0 but display those values as percents (0% - 100%) by specifying the stepper’s FormatString property as stepper.FormatString = "P0"

Gemini is the one who suggested this to me, and I tried it and it works fine on my Windows computer. But Gemini also told me that a problem can arise on Macs if the user tries to manually edit the value in the numeric stepper. Apparently Windows knows to not expect the user to enter a % symbol but Macs will expect the user to enter one, and if they don’t, it gets confused as to how parse it back into the underlying float value (0.0 - 1.0). I don’t have a Mac and can’t verify Gemini’s claims, and I find Gemini’s claims often need to be verified.

My current solution (to avoid this whole issue) is to make the stepper operate with whole numbers and then divide the stepper’s value by 100 in my code.

The problem was that the way I had my sliders set up, they worked much better with the 0.0-1.0 values than the 0-100 values. This was caused by my desire to have 10 ticks on all sliders regardless of the underlying values due to that being more visually pleasing when seeing stacks of sliders.

I was using some complicated math to enforce 10 ticks in all cases and some complicated math to do essentially what SnapToTicks does but it felt weird as the values “snapped” in the stepper but the slider actually moved smoothly.

So, I’ve decided to let the tick marks have various densities. It’s not aesthetically pleasing, but it does let me take advantage of tick snapping which feels a lot better and probably makes more sense, too, from the user’s pov and the user is probably less interested in the aesthetics of the sliders than the functionality. I really liked my 10-tick sliders, tho.

Oh, and I had Grok write this for a sample code (but it was Gemini that I was working with earlier):

slider_factor_vs_percent_example.py (3.9 KB)

Hi @webdunce,

Use Rhino’s build in NumericUpDownWithUnitParsing control, found in Rhino.UI — it’s the control Rhino’s property panels are built from

rhino_ui_percent_slider_example.py (5.1 KB)

– Dale

Thanks for the suggestion and the code sample, Dale. This will also let me use the degree symbol as a unit, which is cool and means I can stop adding “(deg)” to the label.