Skip to content

Commit

Permalink
display entry mode and current char
Browse files Browse the repository at this point in the history
  • Loading branch information
DGrothe-PhD committed Sep 5, 2023
1 parent 1e034e3 commit ce124b0
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 7 deletions.
78 changes: 77 additions & 1 deletion T9KeyboardApp/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions T9KeyboardApp/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ public Form1()
{
InitializeComponent();
EntryMode = Mode.Normal;
DisplayEntryMode();
}

private void Button1_Click(object sender, EventArgs e)
{
textBox1.Text += " ";
}

#region keyhandler
#region keyhandler
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
;
Expand Down Expand Up @@ -68,7 +69,7 @@ private void Form1_KeyUp(object sender, KeyEventArgs e)
textBox1.Text = textBox1.Text.Backspace();
}
}
#endregion
#endregion
private void TypeLetter()
{
char? c = buttonPressed?.Text[0];
Expand All @@ -82,25 +83,28 @@ private void TypeLetter()
if (EntryMode == Mode.Capital)
{
EntryMode = Mode.Normal;
DisplayEntryMode();
}
}

private void ButtonClick(object sender, EventArgs e)
{
//((Button)sender).BackColor = Color.White;
if (buttonPressed != sender as Button)
{
if (timerIsRunning) StopTimer();
StartTimer();
}
if (!timerIsRunning)
if (!timerIsRunning && EntryMode != Mode.Numeric)
{
StartTimer();
}

buttonPressed = sender as Button;
if (int.TryParse("" + buttonPressed?.Text[0], out int index))
{
Buttons.buttons[index].Hit();
lblActiveChar.Text = "" + Buttons.buttons[index].Value();
}
else OperatorButton(buttonPressed?.Text[0]);

textBox1.Select();
Expand Down Expand Up @@ -180,7 +184,7 @@ private void StopTimer()
}


private void buttonModeSwitch_Click(object sender, EventArgs e)
private void ButtonModeSwitch_Click(object sender, EventArgs e)
{
SwitchMode();
textBox1.Select();
Expand All @@ -189,7 +193,9 @@ private void buttonModeSwitch_Click(object sender, EventArgs e)
private void SwitchMode()
{
EntryMode = (Mode)((int)(EntryMode + 1) % 4);
//colors
DisplayEntryMode();
}

private void DisplayEntryMode() => lblEntryMode.Text = Params.EntryModes[(int)EntryMode];
}
}
7 changes: 7 additions & 0 deletions T9KeyboardApp/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,11 @@ public static class Buttons
};

}

public static class Params
{
public static readonly String[] EntryModes = {
"abc", "Abc", "ABC", "123"
};
}
}

0 comments on commit ce124b0

Please sign in to comment.