public MyGuiControlTextbox(IMyGuiControlsParent parent, Vector2 position, MyGuiControlPreDefinedSize predefinedSize, string defaultText, int maxLength, Vector4 textColor, float textScale, MyGuiControlTextboxType type, bool canHandleKeyboardActiveControl, bool drawBackground = true) : base(parent, position, predefinedSize, drawBackground ? MyGuiConstants.BUTTON_BACKGROUND_COLOR : Color.Transparent.ToVector4(), null, drawBackground ? MyGuiManager.GetTextboxTexture(predefinedSize) : null, null, null, true) { Visible = true; m_type = type; m_size = GetPredefinedControlSize(); m_carriagePositionIndex = 0; m_carriageBlinkerTimer = 0; m_canHandleKeyboardActiveControl = canHandleKeyboardActiveControl; m_textColor = MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR; m_textScale = textScale; m_maxLength = maxLength; m_slidingWindowPosition = GetTextAreaPosition(); Text = defaultText; }
public MyGuiControlTextbox( Vector2?position = null, string defaultText = null, int maxLength = 512, Vector4?textColor = null, float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiControlTextboxType type = MyGuiControlTextboxType.Normal, MyGuiControlTextboxStyleEnum visualStyle = MyGuiControlTextboxStyleEnum.Default) : base(position : position, canHaveFocus : true, size : new Vector2(512f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE) { Name = "Textbox"; Type = type; m_carriagePositionIndex = 0; m_carriageBlinkerTimer = 0; m_textColor = textColor ?? Vector4.One; TextScale = textScale; m_maxLength = maxLength; Text = defaultText ?? ""; m_visualStyle = visualStyle; RefreshVisualStyle(); m_slidingWindowOffset = 0f; }
public MyGuiControlTextbox( Vector2? position = null, string defaultText = null, int maxLength = 512, Vector4? textColor = null, float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiControlTextboxType type = MyGuiControlTextboxType.Normal, MyGuiControlTextboxStyleEnum visualStyle = MyGuiControlTextboxStyleEnum.Default) : base(position: position, canHaveFocus: true, size: new Vector2(512f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE) { Name = "Textbox"; Type = type; m_carriagePositionIndex = 0; m_carriageBlinkerTimer = 0; m_textColor = textColor ?? Vector4.One; TextScale = textScale; m_maxLength = maxLength; Text = defaultText ?? ""; m_visualStyle = visualStyle; RefreshVisualStyle(); m_slidingWindowOffset = 0f; }
protected MyGuiControlTextbox AddTextbox(String value, Action <MyGuiControlTextbox> onTextChanged, Vector4?color = null, float scale = 1.0f, MyGuiControlTextboxType type = MyGuiControlTextboxType.Normal, List <MyGuiControlBase> controlGroup = null, MyFontEnum font = MyFontEnum.Debug) { var textbox = new MyGuiControlTextbox(m_currentPosition, value, 6, color, scale, type); textbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; if (onTextChanged != null) { textbox.TextChanged += onTextChanged; } Controls.Add(textbox); m_currentPosition.Y += textbox.Size.Y + 0.01f; if (controlGroup != null) { controlGroup.Add(textbox); } return(textbox); }
// changes type of this textbox (password/text) public void ChangeMyType(MyGuiControlTextboxType type) { m_type = type; }
public MyGuiControlTextbox(IMyGuiControlsParent parent, Vector2 position, MyGuiControlPreDefinedSize predefinedSize, string defaultText, int maxLength, Vector4 textColor, float textScale, MyGuiControlTextboxType type) : this(parent, position, predefinedSize, defaultText, maxLength, textColor, textScale, type, true) { }