/// <summary> /// This function is used to update the contents of the text box. /// </summary> /// <param name="CurrTime">Currend time information</param> /// <param name="CurrKeyboard">Current state of the keyboard.</param> /// <param name="CurrMouse">Current state of the mouse.</param> /// <param name="ProcessMouseEvent">Set true to allow this object to process mouse events, false to ignore them</param> protected override void UpdateContents(GameTime CurrTime, Microsoft.Xna.Framework.Input.KeyboardState CurrKeyboard, Microsoft.Xna.Framework.Input.MouseState CurrMouse, bool ProcessMouseEvent) { if ((ProcessMouseEvent == true) && ((CurrMouse.LeftButton == ButtonState.Pressed) || (CurrMouse.LeftButton == ButtonState.Pressed))) //Mouse button is pressed { if (ClientRegion.Contains(CurrMouse.Position) == false) //Mouse is outside of the control, it has lost focus { if (HasFocus != false) { HasChanged = true; } HasFocus = false; } } if (HasFocus != false) //Only update if the control has focus { string Input = MGInput.GetTypedChars(CurrKeyboard, cPriorKeys); if (CurrTime.TotalGameTime.Milliseconds <= 500) { if (cCursorOn == false) { HasChanged = true; } cCursorOn = true; } else { if (cCursorOn == true) { HasChanged = true; } cCursorOn = false; } if (Input.CompareTo("\b") == 0) { if (Text.Length > 0) { Text = Text.Substring(0, Text.Length - 1); HasChanged = true; } } else { Text += Input; HasChanged = true; } } }