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

Improved Label widget #1113

Open
AndiHofi opened this issue Nov 7, 2021 · 3 comments
Open

Improved Label widget #1113

AndiHofi opened this issue Nov 7, 2021 · 3 comments

Comments

@AndiHofi
Copy link

AndiHofi commented Nov 7, 2021

Hi there,

I would like to have a label widget with some extra features:

  1. Highlight single characters (typically underline) to mark mnemonics
  2. Control overflow behaviour - do not wrap, but render an ellipsis
  3. Maybe have some extra state for mouse hover to allow showing a tooltip

Context: I plan to create an application that has to be fully controllable using the keyboard. I will start to create that widget myself.

@hecrj
Copy link
Member

hecrj commented Nov 8, 2021

(1) and (2) are blocked by #33, as most text-related issues.

(3) can probably be achieved with the Tooltip widget.

@AndiHofi
Copy link
Author

AndiHofi commented Nov 8, 2021

about (1) and (2) - I will work around that - get the positions based on grapheme clusters (using TextInput as inspiration), and then just draw a line so it approximates an underline for a single character. It may not look perfect and break apart with with some fonts or non-latin scripts, but it will be "good enough" for now.

about (3) - as far as I understood, the info if a widget is hovered is needed to display tooltips correctly - otherwise all tooltips would follow the mouse constantly. It may turn out that no such feature is needed, instead box the label (and related widget) into another container that has a "hovered" state

@danielstuart14
Copy link

I think not only for labels, but text overflow as a whole should be configurable. Currently, text seems to only wrap on white-spaces, so an overflow configuration could have 5 options:

  • TextOverflow::WrapWords (default, wrap at whitespace)
  • TextOverflow::WrapChars (wrap at char that would overflow, may break a word)
  • TextOverflow::Clip (Clip text)
  • TextOverflow::Ellipsis (Clip text and add ellipsis to it "...")
  • TextOverflow::Allow (Allow for text to overflow, maintaining the text as it is)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants