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

Fixes #3695 - Add event handlers for Accept in ColorPicker text fields #3711

Merged

Conversation

tznind
Copy link
Collaborator

@tznind tznind commented Aug 31, 2024

Fixes

Proposed Changes/Todos

Make Accept (default key Enter) in text boxes update color selection similarly to focus change events.

@tig I have removed the .NewValue if check as I'm not sure what it means on a focus changing event. Presumably the new value is supposed to indicate whether it is entering or leaving? either way the behaviour seems correct regardless.

I've also removed the -= event handler removals. The reason is because we are now using anonymous delegate (s,_)=> for both Accept and FocusChange.

I don't think they are needed anyway as the lifecycle of the view at that point is where they are Disposed anyway so no events should get raised and they will go out of scope and get cleaned up anyway.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tznind tznind marked this pull request as ready for review August 31, 2024 16:00
@tznind tznind requested a review from tig as a code owner August 31, 2024 16:00
@tig
Copy link
Collaborator

tig commented Aug 31, 2024

@tig I have removed the .NewValue if check as I'm not sure what it means on a focus changing event. Presumably the new value is supposed to indicate whether it is entering or leaving? either way the behaviour seems correct regardless.

Correct. For HasFocusChanging/HasFocusChanged e.NewValue == true indicates what we used to think of as "enter".

Terminal.Gui/Views/ColorPicker.cs Outdated Show resolved Hide resolved
@tznind tznind requested a review from tig August 31, 2024 18:46
@tig tig merged commit 2f6ea90 into gui-cs:v2_develop Aug 31, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ColorPicker should apply changes on Accept as well as OnHasFocusChanged
2 participants