Skip to content

Filtered Textbox #532

@TheNeikos

Description

@TheNeikos

I have worked up a small change to the textbox so that one could indicate a filter method that will be called on insert allowing to have some control over what gets put into a textbox.

The changes can be seen here: https://github.com/TheNeikos/conrod/tree/add-filter_to_textbox

However I have not put this as a PR yet because of two things:

  1. Is something like this wanted? In my current project I would definitely find several uses, but if 2 is not resolved it might not be worth it.
  2. This is a breaking change to the TextBox as for now it requires static dispatch (I implemented it like the react callback), it also means if you do not want to filter you will have to write at least:
.filter(|_string: &mut String, _ch: char|{true})

This does not differ from the react callback, but for those that do not want to filter their input it adds more boilerplate. (Which also exists for the react callback, but I believe that react is a lot more used than a potential filter)

Could I have some input on whether to drop/continue working on it and whether it should be dynamic dispatch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions