LT-22452: fix Lex Edit date field mouse wheel scrolling#754
LT-22452: fix Lex Edit date field mouse wheel scrolling#754johnml1135 wants to merge 1 commit intomainfrom
Conversation
jasonleenaylor
left a comment
There was a problem hiding this comment.
It looks like this test adds another test that pops up a window while it is running. I was hoping to get away from that, I'd rather not have a unit test for this if that is the case.
@jasonleenaylor reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: 1 of 3 files reviewed, all discussions resolved.
There was a problem hiding this comment.
Pull request overview
Adds an application-level IMessageFilter to ensure DataTree scrolls when the mouse wheel is used over child controls that consume WM_MOUSEWHEEL (e.g., RichTextBox inside DateSlice), and introduces configuration stubs in Serena project settings.
Changes:
- Register/unregister a static
WheelRedirectorto interceptWM_MOUSEWHEELand updateDataTree.AutoScrollPosition. - Add
WheelRedirectorinner class implementingIMessageFilterto redirect wheel scrolling based on cursor location. - Extend
.serena/project.ymlwith additional (currently unset) configuration keys.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Src/Common/Controls/DetailControls/DataTree.cs | Installs a message filter to redirect mouse-wheel scrolling to DataTree regardless of focused child control. |
| .serena/project.yml | Adds new Serena configuration keys for line endings and read-only memory patterns. |
Comments suppressed due to low confidence (1)
Src/Common/Controls/DetailControls/DataTree.cs:1
Unregister()is called unconditionally, including whendisposing == false(finalizer path). SinceApplication.Add/RemoveMessageFilteris thread-affine (per-UI-thread message loop), attempting to remove the filter from a non-UI/finalizer thread may not actually remove it (leaking the filter/list entry) and can introduce cross-thread issues. Move thes_wheelRedirector.Unregister(this);call inside theif (disposing)block (or otherwise ensure it executes on the same UI thread that performedRegister).
// Copyright (c) 2015-2017 SIL International
|
@jasonleenaylor - I removed the test. It doesn't really need a test, I was just trying to replicate it. It's hard to replicate without a full test. That is another PR (getting true no-popup testing). |
Summary
Mouse wheel scrolling in Lex Edit stopped working when the pointer was over the date fields. An earlier branch version fixed this by intercepting wheel input at the
DataTreelevel, but that approach was too broad and caused non-modal popup trees to lose their own scrolling.Root Cause
The relevant Lex Edit fields use
editor="Time", which maps toDateSlice, notGenDateSlice.DateSlicehosts a read-onlyRichTextBox. That control consumesWM_MOUSEWHEEL, so the owningDataTreenever receives the wheel event and the detail pane does not scroll.Final Fix
RichTextBoxsubclass insideDateSlicethat interceptsWM_MOUSEWHEEL.DataTree.DataTreehelper logic for converting wheel delta and applying the new scroll position.DataTreemessage filter, so popup trees keep their own wheel behavior.DateSliceWheeltracing for live diagnostics when needed.Verification
./test.ps1 -TestProject "Src/Common/Controls/DetailControls/DetailControlsTests"This change is