Skip to content

Select all text in DragValue when gaining focus via keyboard - #7107

Merged
emilk merged 2 commits into
emilk:mainfrom
Azkellas:dragvalue-focus-tab
Jun 16, 2025
Merged

emilk merged 2 commits into
emilk:mainfrom
Azkellas:dragvalue-focus-tab

Conversation

@Azkellas

@Azkellas Azkellas commented May 31, 2025

Copy link
Copy Markdown
Contributor

Previously, the DragValue widget selected all text when focus was gained via a mouse click, but didn't when focus was gained via keyboard.

egui_old.mp4

This PR makes both gained focus behaving the same way by selecting the text on focus gained via keyboard.

egui_new.mp4
  • I have followed the instructions in the PR template

@github-actions

github-actions Bot commented Jun 2, 2025

Copy link
Copy Markdown

Preview available at https://egui-pr-preview.github.io/pr/7107-dragvalue-focus-tab
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin lucasmerlin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Maybe you can add a private DragValue::select_all or something to deduplicate the selection code?

@lucasmerlin lucasmerlin added feature New feature or request egui labels Jun 2, 2025
@Azkellas
Azkellas force-pushed the dragvalue-focus-tab branch from 709f158 to 92da40b Compare June 2, 2025 20:46
@Azkellas

Azkellas commented Jun 2, 2025

Copy link
Copy Markdown
Contributor Author

Nice! Maybe you can add a private DragValue::select_all or something to deduplicate the selection code?

Done

@lucasmerlin lucasmerlin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@emilk
emilk merged commit 96c3413 into emilk:main Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants