Giter VIP home page Giter VIP logo

Comments (8)

8LWXpg avatar 8LWXpg commented on July 24, 2024

Note: I'm unable to hit a breakpoint under UpdateSettings with the steps mentioned above. But once the Numberbox is set to any numeric value, I am able to reach the breakpoint as intended.

code as following:

public void UpdateSettings(PowerLauncherPluginSettings settings)
{
    _count = (int?)(settings?.AdditionalOptions?.FirstOrDefault(x => x.Key == Count)?.NumberValue) ?? 5;
}

from powertoys.

htcfreek avatar htcfreek commented on July 24, 2024

Okay this is strange.We set NumberBoxMax and NumberBoxMin to double.Max and double.Min.
So theoretically it shouldn't accept the empty value.

@8LWXpg

  • What plugin do you use that produces the crash?
  • Can you please share a screen video?

from powertoys.

8LWXpg avatar 8LWXpg commented on July 24, 2024

Made a minimum example

out.mp4

from powertoys.

htcfreek avatar htcfreek commented on July 24, 2024

@8LWXpg
The PluginAdditionalOptions allow to define min and max values for the number box setting. Can you try if explicitly definig them fixes the bug? (If yes I think we have a problem with the is Null check in the settings app code.)

And maybe a bugreport would help.


from powertoys.

8LWXpg avatar 8LWXpg commented on July 24, 2024

I tested with following option, still has the same issue:

public IEnumerable<PluginAdditionalOption> AdditionalOptions =>
[
    new ()
    {
        PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Numberbox,
        Key = Setting,
        DisplayLabel = "Test NumberBox",
        NumberValue = 5,
        NumberBoxMin = 2,
        NumberBoxMax = 10,
    },
];

from powertoys.

htcfreek avatar htcfreek commented on July 24, 2024

@8LWXpg
Does the number box ignore the min and max settings? Because normally it should fallback to the min value.

from powertoys.

8LWXpg avatar 8LWXpg commented on July 24, 2024

Works with numbers but not when the input box is empty.

out.mp4

from powertoys.

htcfreek avatar htcfreek commented on July 24, 2024

I did some tests and created a test app. The following is happening when clearing the number box and pressing enter:

winui_bug_numberBox
For the input number boxes the Minimum is set to 10 and the Maximum is set to 50.

This only happens if you clear the value. If the value resets because you type a number outside of min/max (e.g. 5000) everything is handled correctly.

@Aaron-Junker , @niels9001
It feels confusing that ...

  • the shown value in the input NumberBox (with min/max set) is different form the real value in the ViewModel variable.
  • the number box des not handle empty input correctly if bind against a double.

I think the best idea is to move the min/max validation into the ViewModel and also add a NaN validation there. Thoughts and ideas?


Explanation what happens:

If you clear the number box the value form the number box is empty as it is a normal text box with number features. That causes the view model variable to initialize with its default value (int) or beeing NaN (double). If the value of the view model variable is not between the minimum and maximum as defined in the NumberBox properties, the NumberBox shows the minimum or maximum value that is defined in XAML code instead of the view model variable value.

from powertoys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.