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)
{
if (args.KeyCode == Keys.Return) {
if (this.Text != "")
{
if (this.Text != "") {
string message = this.Text;
this.Text = "";
if (CurrentHistoryEntry == null) {
InputHistory.AddLast (message);
}
else {
} else {
CurrentHistoryEntry.Value = message;
CurrentHistoryEntry = null;
}
@@ -49,8 +47,7 @@ namespace WorldOfPeacecraft
if (InputHistory.Count > 0) {
if (CurrentHistoryEntry == null) {
CurrentHistoryEntry = InputHistory.Last;
if (this.Text != "")
{
if (this.Text != "") {
InputHistory.AddLast (this.Text);
}
this.Text = CurrentHistoryEntry.Value;
@@ -65,8 +62,7 @@ namespace WorldOfPeacecraft
}
}
} else if (args.KeyCode == Keys.Down) {
if (CurrentHistoryEntry != null)
{
if (CurrentHistoryEntry != null) {
CurrentHistoryEntry.Value = this.Text;
CurrentHistoryEntry = CurrentHistoryEntry.Next;
if (CurrentHistoryEntry == null) {
@@ -75,6 +71,9 @@ namespace WorldOfPeacecraft
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;
}
public void FocusMap ()
{
MapPanel.Focus();
}
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);