DropDownBox Class (RWE.GameOn.Core.Extensions)

Class
DropDownBox

Usage:

Represents a drop down field with multiple select-able options.

DropDownBox

Properties:

  • Text.ToString
    String- Provide a default text value for the UI Element.
DropDownBox1.Text.ToString = "Select an option...";
  • Contents
    Array – Provide an array of select-able options for the UI Element.
DropDownBox1.Contents = [
                          Option1,
                          Option2,
                        ]
  • Contents.Function
    Array – Provide a function to be called upon selection of the UI Element Contents.
    Each line corresponds to the line in the array for .Contents
DropDownBox1.Contents.Function = [
                                   function1(), //on selecting Option1
                                   function2(), //on selecting Option2
                                 ]
  • Enabled
    Boolean – Defines whether the UI Element is interact-able or not.
DropDownBox1.Enabled = true;
  • AutoSize
    Boolean – Sets whether the UI Element should be autosized.
DropDownBox1.AutoSize = true;
  • BorderStyle
    Variable – Sets the border style of the UI Element.
DropDownBox1.BorderStyle = Single;
  • BorderStyle.Colour
    Variable – Sets the border colour of the UI Element.
DropDownBox1.BorderStyle.Colour = ColourSpace.Red;
DropDownBox1.BorderStyle.Colour = new ColourSpace(HEX("#hexcode"));
DropDownBox1.BorderStyle.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
DropDownBox1.BorderStyle.Colour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));

//You can use .Color and ColorSpace too!
  • BorderStyle.Weight
    Variable – Sets the border weight of the UI Element.
DropDownBox1.BorderStyle.Weight = 1px;
  • BackColour
    Variable – Sets the background colour of the UI Element.
DropDownBox1.BackColour = ColourSpace.Red;
DropDownBox1.BackColour = new ColourSpace(HEX("#hexcode"));
DropDownBox1.BackColour = new ColourSpace(ARGB(RRR,GGG,BBB,ALPHA));
DropDownBox1.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.
DropDownBox1.Anchor = top, left;
DropDownBox1.Anchor = bottom, top;
DropDownBox1.Anchor = left;
  • Visibility
    Variable – Determines whether the UI Element is visible or not.
DropDownBox1.Visibility = visible;
DropDownBox1.Visibility = invisible;

 

Example:

new ContentPanel = Panel1();
         Panel1.Dock = fill;
         Panel1.Padding.Left = 3px;
         Panel1.Contents 
         {
             new DropDownBox = Selector();
                 Selector.Contents = [
                                       Option1,
                                       Option2,
                                     ]
                 Selector.Contents.Function = [
                                                  function1(), //on selecting Option1
                                                  function2(), //on selecting Option2
                                              ]
                 Selector.AutoSize = true;
                 Selector.Text.ToString = "Select One";
         }
Menu