public override string GetNumber(string message) { string result = string.Empty; this.EnableInput(); this.WindowManager.GotoPosition(new TextPosition(this.State.InputPosition, 0)); string wrapped = this.WindowManager.WrapText(message, 0x28); this.WindowManager.PrintFormatted(wrapped); this.DisableInput(); TextBoxControl textBox = new TextBoxControl(this.Interpreter); textBox.Text = string.Empty; textBox.MaxTextLength = 4; if (textBox.DoModal()) { result = textBox.Text; } this.RedrawInput(); return(result); }
public override string GetString(string message, int maxLength, byte row, byte column) { string result = string.Empty; bool inputEditDisabled = !this.InputEditEnabled; this.WindowManager.PushTextPosition(); this.EnableInput(); if (row < 0x19) { this.WindowManager.GotoPosition(new TextPosition(row, column)); } string wrapped = this.WindowManager.WrapText(message, 0x40); this.WindowManager.PrintFormatted(wrapped); TextBoxControl textBox = new TextBoxControl(this.Interpreter); textBox.Text = string.Empty; textBox.MaxTextLength = maxLength; if (textBox.DoModal()) { result = textBox.Text; } this.WindowManager.PopTextPosition(); if (inputEditDisabled) { this.DisableInput(); } return(result); }
public bool DoModal() { this.WindowManager.PushTextColor(); this.WindowManager.PushTextPosition(); this.WindowManager.SetTextColor(WindowForegroundColor, WindowBackgroundColor); this.WindowManager.DisplayMessageBox(this.Title, 0, this.Width, true); this.WindowManager.GotoPosition(new TextPosition((byte)this.WindowManager.MessageState.TextLowRow, (byte)this.WindowManager.MessageState.TextLeftColumn)); this.WindowManager.ClearWindow(new TextPosition((byte)this.WindowManager.MessageState.TextLowRow, (byte)this.WindowManager.MessageState.TextLeftColumn), new TextPosition((byte)this.WindowManager.MessageState.TextLowRow, (byte)(this.WindowManager.MessageState.TextRightColumn - 1)), 0); this.WindowManager.SetTextColor(TextBoxForegroundColor, TextBoxBackgroundColor); TextBoxControl textBox = new TextBoxControl(this.Interpreter); textBox.Text = this.Text; textBox.MaxTextLength = this.MaxTextLength; bool result = textBox.DoModal(); this.Text = result ? textBox.Text : string.Empty; this.WindowManager.CloseWindow(); this.WindowManager.PopTextPosition(); this.WindowManager.PopTextColor(); return(result); }