From 40b4c29b969f97004ec51c3c22b4b8263fadbef4 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Mon, 19 Jun 2017 17:30:55 +1000 Subject: Fixed keyboard input & instruction pointer display --- ShiftOS.WinForms/Applications/MindBlow.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/MindBlow.cs b/ShiftOS.WinForms/Applications/MindBlow.cs index 15361c2..4fcda03 100644 --- a/ShiftOS.WinForms/Applications/MindBlow.cs +++ b/ShiftOS.WinForms/Applications/MindBlow.cs @@ -22,6 +22,7 @@ namespace ShiftOS.WinForms.Applications { private TextBox box; private KeysConverter kc; + public KeyPressEventHandler handler; public TextBoxStream(TextBox mybox) { kc = new KeysConverter(); @@ -55,7 +56,7 @@ namespace ShiftOS.WinForms.Applications { object lck = new object(); int ptr = offset; - KeyPressEventHandler handler = (o, a) => + handler = (o, a) => { lock (lck) { @@ -98,6 +99,7 @@ namespace ShiftOS.WinForms.Applications private static string[] DefaultMem; private BFInterpreter Interpreter; private Thread InterpreterThread; + private TextBoxStream consolestr; private void DoLayout() { memlist.Left = 0; @@ -121,7 +123,8 @@ namespace ShiftOS.WinForms.Applications for (ushort i = 0; i < 30000; i++) DefaultMem[i] = "0"; memlist.Items.AddRange(DefaultMem); - Interpreter = new BFInterpreter(new TextBoxStream(consoleout), this); + consolestr = new TextBoxStream(consoleout); + Interpreter = new BFInterpreter(consolestr, this); } public void IPtrMoved(int newval) @@ -212,6 +215,7 @@ namespace ShiftOS.WinForms.Applications InterpreterThread.Abort(); } catch { } + consoleout.KeyPress -= consolestr.handler; } private void reset_Click(object sender, EventArgs e) -- cgit v1.2.3