Iced: Text input widget

Created on 23 Oct 2019  路  2Comments  路  Source: hecrj/iced

A widget where the user can type raw text and passwords.

This widget will have a quite complex event logic, potentially coupled with text rendering. Some examples are:

  • Text cursor positioning based on a mouse click
  • Text selection
  • Clipboard interaction (copy & paste)
  • Text editing shortcuts (go to start, go to end, etc.)

It also needs scrollable / clippable text support (see #24), as the introduced text may not fit the input and scrolling based on the text cursor will need to be implemented.

Additionally, the text cursor should blink at a regular interval, which can be considered an _animation_.

I think we should start simple here, and build a text widget with the most basic functionality: click to focus and type to fill. We can improve the implementation with time as the library matures.

The end-user API could look like this:

pub enum Message {
    TextChanged(String),
}

let text_input = text_input::State::new();
let text = "Hello";

TextInput::new(&mut text_input, &text, Message::TextChanged);
feature

Most helpful comment

@hecrj I was playing around with this, my branch may be a useful starting point: https://github.com/shanehandley/iced/tree/shanehandley/text-input

Thanks for your work 馃憤

All 2 comments

@hecrj I was playing around with this, my branch may be a useful starting point: https://github.com/shanehandley/iced/tree/shanehandley/text-input

Thanks for your work 馃憤

@shanehandley I noticed a couple of days ago :) Thank you! It's great to see that you got quite far considering the current lack of documentation. Please, let me know if there was anything awkward or confusing!

I am currently working on the TextInput in the feature/text-input branch. It is built on top of scrollables support (see #35), as we need clipping when the input value overflows. We can probably add your iced_web widget implementation there and, as always, any feedback is appreciated!

If you ever feel like trying to implement other stuff mentioned in the ROADMAP, feel free to reach out to me on Discord (@lone_scientist#9554). This way we can share ideas and get on the same page. I will set up a server for any potential contributors soon (see #19).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Plecra picture Plecra  路  4Comments

CallistoM picture CallistoM  路  3Comments

jiminycrick picture jiminycrick  路  3Comments

Gohla picture Gohla  路  4Comments

casperstorm picture casperstorm  路  3Comments