1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-16 03:24:08 +00:00

Rework ItemContainerGenerator StatusChanged hack

This is another attempt to fix the ListView keyboard position
behavior.  Basic problem: if you change something in the ListView,
the keyboard position is lost, and WPF doesn't expose a nice way to
save and restore it.  It appears the way to set the position is by
calling Focus() on the specific item you want to have as the "current"
keyboard position, but you can only do that at certain times.

This attempt removes the grid-splitter resize hack, in favor of just
setting a "needs refocus" flag when we restore the selection set.
This causes Focus() to be called from the StatusChanged callback on
the next event with status="containers generated".

During testing I noticed some other odd behavior: if you used "goto"
to jump to an address, up/down arrows would change focus to a
different control (menu items, grid splitters, etc).  The problem
there was that we were setting focus to the ListView control rather
than to a ListViewItem, so arrow keys were in control-traversal mode
rather than list-walk mode.  That is also fixed.

(Issue #105)
This commit is contained in:
Andy McFadden
2021-08-08 17:39:21 -07:00
parent 3368182e14
commit 19ba34760b
3 changed files with 58 additions and 39 deletions

View File

@@ -2554,6 +2554,7 @@ namespace SourceGen {
mMainWin.CodeListView_EnsureVisible(index);
mMainWin.CodeListView_SelectRange(index, 1);
mMainWin.CodeListView_SetSelectionFocus();
return;
}
@@ -2571,7 +2572,7 @@ namespace SourceGen {
MessageBoxImage.Information);
mFindStartIndex = -1;
mMainWin.CodeListView_Focus();
//mMainWin.CodeListView_Focus();
}
public bool CanFormatAsWord() {
@@ -2774,7 +2775,7 @@ namespace SourceGen {
if (dlg.ShowDialog() == true) {
GoToLocation(new NavStack.Location(dlg.TargetOffset, 0, false),
GoToMode.JumpToCodeData, true);
mMainWin.CodeListView_Focus();
//mMainWin.CodeListView_Focus();
}
}
@@ -2920,6 +2921,7 @@ namespace SourceGen {
// Update the selection.
mMainWin.CodeListView_SelectRange(lineIndex, 1);
mMainWin.CodeListView_SetSelectionFocus();
if (doPush) {
// Update the back stack and associated controls.