Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text input widget #25

Closed
hecrj opened this issue Oct 23, 2019 · 2 comments · Fixed by #37
Closed

Text input widget #25

hecrj opened this issue Oct 23, 2019 · 2 comments · Fixed by #37
Assignees
Labels
feature New feature or request
Milestone

Comments

@hecrj
Copy link
Member

hecrj commented Oct 23, 2019

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);
@hecrj hecrj added the feature New feature or request label Oct 23, 2019
@hecrj hecrj added this to the 0.1.0 milestone Oct 23, 2019
@hecrj hecrj mentioned this issue Oct 23, 2019
@hecrj hecrj added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Oct 23, 2019
@hecrj hecrj self-assigned this Oct 30, 2019
@shanehandley
Copy link

@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 👍

@hecrj
Copy link
Member Author

hecrj commented Oct 31, 2019

@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).

@hecrj hecrj mentioned this issue Nov 2, 2019
1 task
@hecrj hecrj closed this as completed in #37 Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants