public void TextInput(char c) { // Handle special character input. if (KeyboardInput.AltWasPressed) { specialChar = null; } if (KeyboardInput.AltIsPressed) { // accumulate keystrokes specialChar += c; return; } // Grab the tab and use it for cycling through the focus options. if (c == '\t') { ToggleEditTarget(); KeyboardInput.ClearAllWasPressedState(Keys.Tab); return; } if (EditingCreator || EditingPin) { // Ignore enter. if (c == 13) { return; } string str = new string(c, 1); str = TextHelper.FilterInvalidCharacters(str); if (!string.IsNullOrEmpty(str)) { // Check if we've gotten too long. if (EditingCreator) { creatorBlob.InsertString(str); int width = creatorBlob.GetLineWidth(0); if (width >= creatorBox.Width) { // Bzzzt! Foley.PlayNoBudget(); for (int i = 0; i < str.Length; i++) { creatorBlob.Backspace(); } } else { Foley.PlayClickDown(); } } else if (EditingPin) { // With the pin, max out at 4 digits and only allow digits. if (pinBlob.ScrubbedText.Length > 3 || !char.IsDigit(str[0])) { Foley.PlayNoBudget(); } else { pinBlob.InsertString(str); } } } } } // end of TextInput()