Giter Site home page Giter Site logo

Comments (4)

the-marenga avatar the-marenga commented on July 18, 2024

Looking at the source, this seems to be because:

if layout
.bounds()
.contains(cursor.position().unwrap_or_default())

is not met, which ignores all inputs.

My question then becomes, why would this check be necessary for keyboard inputs?
Mouse stuff might be a different story, but keyboard events check, if the input is focused themself anyways.

if child
.state
.downcast_mut::<text_input::State<Renderer::Paragraph>>()
.is_focused() =>

Changing the initial check to:

        if layout
            .bounds()
            .contains(cursor.position().unwrap_or_default()) 
             || matches!(event, Event::Keyboard(keyboard::Event::KeyPressed { .. }))

Makes the widget behave as I would expect

from iced_aw.

genusistimelord avatar genusistimelord commented on July 18, 2024

make sure to try that with multiple number inputs and see if they all input when the keyboard is pressed. Also yeah ill need to check to see what iced currently is doing for textboxes as this was a widget made back before many of the major changes occurred.

from iced_aw.

the-marenga avatar the-marenga commented on July 18, 2024

Just tested this with multiple number_inputs with this fix and they all behave as expected. Completely independent. They behave exactly like multiple text_inputs on switching/losing focus, whilst inputing text.

The only thing to note is that this now allows scrolling one element, whilst inputing text into another, but I am pretty sure this is how it would be expected to behave.

This quick fix does however call self.content.on_event for each unfocused number_input, whenever a key is pressed, instead of returning event::Status::Ignored, which might introduce something I am not aware of rn, or lead to slower perf.
In addition the keyboard input does not work, when the mouse is over the inc/dec buttons, as that logic supercedes the keyboard input checks.

If you want, I can make a PR, that fixes this in a more sophisticated way

from iced_aw.

genusistimelord avatar genusistimelord commented on July 18, 2024

please feel free too. yeah we did not want to cause weird bugs if you used the buttons over the keyboard input.

from iced_aw.

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.