TextBox Class (RWE.GameOn.Core)

Class
TextBox

Usage:

Represents a form control that allows for the input of text by a user.

TextBox

Properties:

  • Text.ToString
    String – Sets the text value for the UI Element.
TextBox1.Text.ToString = "Type Here!";
  • Enabled
    Boolean – Defines whether the UI Element is interact-able or not.
TextBox1.Enabled = false;
  • AutoSize
    Boolean – Defines whether the UI Element should be autosized.
TextBox1.AutoSize = true;
  • Height
    Variable – Defines the height of the UI Element.
TextBox1.Height = 32px;
  • Width
    Variable – Defines the width of the UI Element.
TextBox1.Width = 500px;
  • Font
    Variable – Sets the font for the UI Element.
TextBox1.Font = default;
TextBox1.Font = new Font("Arial", 24,FontStyle.Bold);
  • Font.Size
    Variable – Sets the size of the font
TextBox1.Font.Size = default;
TextBox1.Font.Size = 12px;

//Note: you can change the font size using .Font, as follows:
Button1.Font = new Font("Arial", 12,FontStyle.Bold);
  • Font.Style
    Variable – Sets the style of the font
TextBox1.Font.Style = FontStyle.Bold;
TextBox1.Font.Style = FontStyle.Underline;
TextBox1.Font.Style = FontStyle.Italic;
TextBox1.Font.Style = FontStyle.Strikethrough;

//Note: you can change the font style using .Font, as follows:
Button1.Font = new Font("Arial", 12,FontStyle.Bold);
  • Font.Weight
    Variable – Sets the weight of the font.
TextBox1.Font.Weight = FontStyle.SemiBold;
TextBox1.Font.Weight = 300;

//Note: you can change the font style using .Font, as follows:
TextBox1.Font = new Font("CustomFont", 12,FontStyle.SemiBold);
TextBox1.Font = new Font("CustomFont", 12,Font.Weight(300));
  • BorderStyle
    Variable – Sets the border style of the UI Element.
TextBox1.BorderStyle = Single;
  • BorderStyle.Colour
    Variable – Sets the border colour of the UI Element.
TextBox1.BorderStyle.Colour = ColourSpace.Red;
TextBox1.BorderStyle.Colour = new ColourSpace(HEX("#hexcode"));
TextBox1.BorderStyle.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
TextBox1.BorderStyle.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));

//You can use .Color and ColorSpace too!
  • BorderStyle.Weight
    Variable – Sets the border weight.
TextBox1.BorderStyle.Weight = 1px;
  • BackColour
    Variable – Sets the background colour.
TextBox1.BackColour = ColourSpace.Red;
TextBox1.BackColour = new ColourSpace(HEX("#hexcode"));
TextBox1.BackColour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
TextBox1.BackColour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));

//You can use .BackColor and ColorSpace too!
  • Anchor
    Variable – Anchors the UI Element relative to a side or multiple sides of the parent container.
TextBox1.Anchor = top, left;
TextBox1.Anchor = bottom, top;
TextBox1.Anchor = left;
  • Activity
    Clause – Creates a new activity when the UI Element is interacted with. By default, the interaction is OnClick.
//OnClick
TextBox1.Activity(new Activity) { //activities go here }

//OnClick (Defined)
TextBox1.Activity(new Activity, OnClick) { //activities go here }

//OnHover
TextBox1.Activity(new Activity, OnHover) { //activities go here }
      • Includes the following actions:
        • OnClick
        • OnHover
        • OnKeyPress
        • OnKeyPressEnter
        • OnTextChanged
  • Visibility
    Variable – Determines whether the UI Element is visible or not.
TextBox1.Visibility = visible;
TextBox1.Visibility = invisible;

 

Example:

new TextBox1= Panel1();
         Panel1.Dock = fill;
         Panel1.Padding.Left = 3px;
         Panel1.Contents 
         {
             new TextBox = NameField();
                 NameField.Text.ToString = "Name"
                 NameField.AutoSize = true;
                 NameField.BackColour = ColourSpace.Yellow;
         }
Menu