Fix #505: Add Enter key support for threshold inputs and ensure 2D slices update immediately#1382
Open
sh1vam31 wants to merge 1 commit intoinvesalius:masterfrom
Open
Fix #505: Add Enter key support for threshold inputs and ensure 2D slices update immediately#1382sh1vam31 wants to merge 1 commit intoinvesalius:masterfrom
sh1vam31 wants to merge 1 commit intoinvesalius:masterfrom
Conversation
Contributor
Author
|
This PR resolves issue #505 by adding wx.TE_PROCESS_ENTER and an OnEnter handler to the threshold text inputs so the Enter key works correctly. While testing, I also noticed that manually typing a value didn't instantly update the 2D viewer colors (you had to scroll to force a refresh). I fixed this by ensuring the text inputs emit both the CHANGING and CHANGED events, so the 2D slices now update immediately, just like when using the visual slider. Could you please review this when you have a moment? Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Fixes #505
This PR resolves two interconnected issues regarding the manual entry of threshold values in the "Select Region of Interest" panel
Changes:
Enter Key Support: The InvSpinCtrl and InvFloatSpinCtrl widgets previously lacked the wx.TE_PROCESS_ENTER style flag and did not handle wx.EVT_TEXT_ENTER. Users had to explicitly click away to trigger a focus-loss event to commit values. I added the necessary flags and bound the OnEnter method to successfully capture and apply the threshold when the Enter key is pressed.
Immediate 2D Slice Updates: When manually typing a value (or using the spin arrows), the OnMinMouseWheel and OnMaxMouseWheel methods in GradientCtrl only emitted a myEVT_THRESHOLD_CHANGED event. Because the myEVT_THRESHOLD_CHANGING event was skipped, the 2D slices (Axial, Coronal, Sagittal) did not visually update their colors to reflect the new mask until the user manually scrolled the viewer. I updated these methods to correctly emit both CHANGING and CHANGED events, perfectly mirroring the visual slider's behavior and forcing an immediate redraw of the 2D viewers.
Testing:
Open the application and load any dataset.
Go to the "Select Region of Interest" task panel.
Under "Mask properties", click inside either the minimum or maximum threshold text box.
Type a new value and press Enter.
Verify that the threshold slider moves immediately AND the colored mask overlay on the 2D slices instantly updates without requiring any extra mouse clicks or scrolling.
After fix:
Screen.Recording.2026-04-26.at.2.18.30.AM.mov