Let tab walk every box again
Tab was doing what space does, which is wrong. N1MM's EntryWindow does not touch the tab key — ProcessCmdKey only remaps NumPad Enter — so tab there is plain navigation through the boxes in the order they are laid out: the reports at tab index 3 and 4, the name at 26, the section at 30, the zone at 32, the comment at 40. Only space goes through NextTab, which is the walk that steps over the reports. So tab now walks every box, reports, name and comment included, and shift and tab walk back. Space is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
22
README.md
22
README.md
@@ -178,19 +178,25 @@ to `SM3ABC`, and the key sends `SM3ABC TU DL1ABC`.
|
||||
Beside the exchange are a Name box and a Comment box, as N1MM has them. Neither
|
||||
is part of the exchange, so neither holds up a contact: they fill the log's Name
|
||||
and Comment columns, and a contest that exchanges a name uses that instead.
|
||||
Neither is in the space and tab walk, as neither is in N1MM's — they are there
|
||||
for the mouse. The name is filled from the call history file when there is one,
|
||||
Neither is in the space walk, as neither is in N1MM's; tab reaches both. The name is filled from the call history file when there is one,
|
||||
and what the call history says in its UserText column appears under the entry
|
||||
boxes.
|
||||
|
||||
### Space and tab
|
||||
|
||||
Space and tab move between the callsign box and the exchange boxes and round
|
||||
again, which is N1MM's walk. The report boxes are stepped over, because nobody
|
||||
types 599: leaving the callsign box fills them with the report for the mode,
|
||||
599 on CW and digital, 59 on phone. So in CQ WW, space takes you from the
|
||||
callsign straight to the zone, and space again brings you back to the callsign.
|
||||
Click a report box to change one.
|
||||
They are not the same key, and N1MM does not treat them as one.
|
||||
|
||||
Space moves between the callsign box and the exchange boxes and round again,
|
||||
stepping over the report boxes, because nobody types 599: leaving the callsign
|
||||
box fills them with the report for the mode, 599 on CW and digital, 59 on phone.
|
||||
It also steps over a box this station is not asked for, such as the state in
|
||||
CQ WW RTTY for a station outside the US and Canada. So in CQ WW, space takes you
|
||||
from the callsign straight to the zone, and space again brings you back.
|
||||
|
||||
Tab walks every box in turn — callsign, the exchange including the reports, the
|
||||
name and the comment — and round again; shift and tab go the other way. N1MM
|
||||
does not touch the tab key at all, so tab there walks its boxes in the order
|
||||
they are laid out, which is what this does.
|
||||
|
||||
Two lights sit beside the run switch: the left one is green while a radio is
|
||||
answering, the right one red while something is going out on the air.
|
||||
|
||||
@@ -311,9 +311,9 @@ public sealed partial class EntryWindow : Window
|
||||
e.Handled = true;
|
||||
session.SwapRadio();
|
||||
break;
|
||||
case Key.Tab when FocusedIsEntryBox():
|
||||
case Key.Tab when FocusedIsEntryBox() || FocusedIsNoteBox():
|
||||
e.Handled = true;
|
||||
MoveFocus(forward: !e.KeyModifiers.HasFlag(KeyModifiers.Shift));
|
||||
MoveToNextBox(forward: !e.KeyModifiers.HasFlag(KeyModifiers.Shift));
|
||||
break;
|
||||
case Key.Z when e.KeyModifiers.HasFlag(KeyModifiers.Control):
|
||||
e.Handled = true;
|
||||
@@ -394,9 +394,9 @@ public sealed partial class EntryWindow : Window
|
||||
boxes[0].Focus();
|
||||
}
|
||||
|
||||
/// Tab and space walk the callsign box and the exchange boxes, and round
|
||||
/// again, as N1MM's do. The name and comment boxes are not in the walk,
|
||||
/// because they are not part of the exchange; they are there for the mouse.
|
||||
/// What space does: the callsign box and the exchange boxes, stepping over
|
||||
/// the reports and over a box this station is not asked for, and round to
|
||||
/// the callsign again. This is N1MM's NextTab.
|
||||
private void MoveFocus(bool forward)
|
||||
{
|
||||
if (Logging is null || boxes.Count == 0)
|
||||
@@ -428,6 +428,28 @@ public sealed partial class EntryWindow : Window
|
||||
FocusEntryBox();
|
||||
}
|
||||
|
||||
/// What tab does: every box in turn, reports, name and comment included,
|
||||
/// and round again. N1MM does not touch the tab key, so tab there walks
|
||||
/// the boxes in the order they are laid out, and this walks the same ones.
|
||||
private void MoveToNextBox(bool forward)
|
||||
{
|
||||
if (Logging is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<TextBox> all = [.. boxes, .. new[] { nameBox, commentBox }.OfType<TextBox>()];
|
||||
int at = all.FindIndex(box => box.IsFocused);
|
||||
int next = ((at < 0 ? 0 : at) + (forward ? 1 : -1) + all.Count) % all.Count;
|
||||
if (next < boxes.Count)
|
||||
{
|
||||
Logging.Entry.FocusOn(next);
|
||||
FocusEntryBox();
|
||||
return;
|
||||
}
|
||||
all[next].Focus();
|
||||
all[next].CaretIndex = all[next].Text?.Length ?? 0;
|
||||
}
|
||||
|
||||
private void FocusEntryBox()
|
||||
{
|
||||
if (Logging is null)
|
||||
@@ -457,6 +479,8 @@ public sealed partial class EntryWindow : Window
|
||||
|
||||
private bool FocusedIsEntryBox() => boxes.Any(b => b.IsFocused);
|
||||
|
||||
private bool FocusedIsNoteBox() => nameBox?.IsFocused == true || commentBox?.IsFocused == true;
|
||||
|
||||
/// The buttons N1MM puts under its function keys. Each one does what its
|
||||
/// key does, so there is one place deciding what happens.
|
||||
private void OnStopSending(object? sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user