Fokus wird auf Map gelegt, wenn in Chatfenster ESC-Gedrückt wird

This commit is contained in:
2014-05-02 11:55:03 +02:00
parent d14eaa4822
commit 721f2c452e
2 changed files with 13 additions and 9 deletions

View File

@@ -29,14 +29,12 @@ namespace WorldOfPeacecraft
private void KeyDownEvent (object o, KeyEventArgs args) private void KeyDownEvent (object o, KeyEventArgs args)
{ {
if (args.KeyCode == Keys.Return) { if (args.KeyCode == Keys.Return) {
if (this.Text != "") if (this.Text != "") {
{
string message = this.Text; string message = this.Text;
this.Text = ""; this.Text = "";
if (CurrentHistoryEntry == null) { if (CurrentHistoryEntry == null) {
InputHistory.AddLast (message); InputHistory.AddLast (message);
} } else {
else {
CurrentHistoryEntry.Value = message; CurrentHistoryEntry.Value = message;
CurrentHistoryEntry = null; CurrentHistoryEntry = null;
} }
@@ -49,9 +47,8 @@ namespace WorldOfPeacecraft
if (InputHistory.Count > 0) { if (InputHistory.Count > 0) {
if (CurrentHistoryEntry == null) { if (CurrentHistoryEntry == null) {
CurrentHistoryEntry = InputHistory.Last; CurrentHistoryEntry = InputHistory.Last;
if (this.Text != "") if (this.Text != "") {
{ InputHistory.AddLast (this.Text);
InputHistory.AddLast(this.Text);
} }
this.Text = CurrentHistoryEntry.Value; this.Text = CurrentHistoryEntry.Value;
args.Handled = true; args.Handled = true;
@@ -65,8 +62,7 @@ namespace WorldOfPeacecraft
} }
} }
} else if (args.KeyCode == Keys.Down) { } else if (args.KeyCode == Keys.Down) {
if (CurrentHistoryEntry != null) if (CurrentHistoryEntry != null) {
{
CurrentHistoryEntry.Value = this.Text; CurrentHistoryEntry.Value = this.Text;
CurrentHistoryEntry = CurrentHistoryEntry.Next; CurrentHistoryEntry = CurrentHistoryEntry.Next;
if (CurrentHistoryEntry == null) { if (CurrentHistoryEntry == null) {
@@ -75,6 +71,9 @@ namespace WorldOfPeacecraft
this.Text = CurrentHistoryEntry.Value; this.Text = CurrentHistoryEntry.Value;
} }
} }
} else if (args.KeyCode == Keys.Escape) {
((Gui)this.Parent.Parent).FocusMap();
args.Handled = true;
} }
} }
} }

View File

@@ -24,6 +24,11 @@ namespace WorldOfPeacecraft
Backend = backend; Backend = backend;
} }
public void FocusMap ()
{
MapPanel.Focus();
}
protected override void OnLoad (EventArgs e) protected override void OnLoad (EventArgs e)
{ {
base.OnLoad (e); base.OnLoad (e);