Skip to content

LT-22452: fix Lex Edit date field mouse wheel scrolling#754

Open
johnml1135 wants to merge 1 commit intomainfrom
LT-22452
Open

LT-22452: fix Lex Edit date field mouse wheel scrolling#754
johnml1135 wants to merge 1 commit intomainfrom
LT-22452

Conversation

@johnml1135
Copy link
Copy Markdown
Contributor

@johnml1135 johnml1135 commented Mar 11, 2026

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 DataTree level, 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 to DateSlice, not GenDateSlice.

DateSlice hosts a read-only RichTextBox. That control consumes WM_MOUSEWHEEL, so the owning DataTree never receives the wheel event and the detail pane does not scroll.

Final Fix

  • Add a small RichTextBox subclass inside DateSlice that intercepts WM_MOUSEWHEEL.
  • Forward the wheel input from that hosted control to the owning DataTree.
  • Keep the shared DataTree helper logic for converting wheel delta and applying the new scroll position.
  • Do not use an application-wide DataTree message filter, so popup trees keep their own wheel behavior.
  • Keep optional DateSliceWheel tracing for live diagnostics when needed.

Verification

  • Manual: verified in a live build that Lex Edit date fields scroll again and the grammatical-info popup keeps its own scrolling behavior.
  • Automated: ./test.ps1 -TestProject "Src/Common/Controls/DetailControls/DetailControlsTests"

This change is Reviewable

@johnml1135 johnml1135 requested review from Copilot and jasonleenaylor and removed request for Copilot March 11, 2026 17:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

NUnit Tests

    1 files  ±0      1 suites  ±0   5m 45s ⏱️ -44s
4 079 tests +5  4 008 ✅ +5  71 💤 ±0  0 ❌ ±0 
4 088 runs  +5  4 017 ✅ +5  71 💤 ±0  0 ❌ ±0 

Results for commit 85bf8ed. ± Comparison against base commit 7a418b8.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

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.

Copilot AI review requested due to automatic review settings March 12, 2026 16:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 WheelRedirector to intercept WM_MOUSEWHEEL and update DataTree.AutoScrollPosition.
  • Add WheelRedirector inner class implementing IMessageFilter to redirect wheel scrolling based on cursor location.
  • Extend .serena/project.yml with 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 when disposing == false (finalizer path). Since Application.Add/RemoveMessageFilter is 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 the s_wheelRedirector.Unregister(this); call inside the if (disposing) block (or otherwise ensure it executes on the same UI thread that performed Register).
// Copyright (c) 2015-2017 SIL International

@sillsdev sillsdev deleted a comment from Copilot AI Mar 13, 2026
@johnml1135
Copy link
Copy Markdown
Contributor Author

@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).

@johnml1135 johnml1135 changed the title LT-22452 - fix mouse scrolling on date field in lex edit LT-22452: fix Lex Edit date field mouse wheel scrolling Apr 1, 2026
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.

3 participants