void OnSubmit(ControlBase control, EventArgs args) { Control.TextBox box = control as Control.TextBox; UnitPrint(String.Format("TextBox: OnSubmit: {0}", box.Text)); }
public TextBox(ControlBase parent) : base(parent) { m_Font1 = Skin.DefaultFont.Copy(); m_Font1.FaceName = "Courier New"; // fixed width font! m_Font2 = Skin.DefaultFont.Copy(); m_Font2.FaceName = "Times New Roman"; m_Font2.Size *= 3; m_Font3 = Skin.DefaultFont.Copy(); m_Font3.Size += 5; VerticalLayout vlayout = new VerticalLayout(this); { DockLayout dockLayout = new DockLayout(vlayout); { VerticalLayout vlayout2 = new VerticalLayout(dockLayout); vlayout2.Dock = Dock.Left; vlayout2.Width = 200; { /* Vanilla Textbox */ { Control.TextBox textbox = new Control.TextBox(vlayout2); textbox.Margin = Margin.Five; textbox.SetText("Type something here"); textbox.TextChanged += OnEdit; textbox.SubmitPressed += OnSubmit; } { Control.TextBoxPassword textbox = new Control.TextBoxPassword(vlayout2); textbox.Margin = Margin.Five; //textbox.MaskCharacter = '@'; textbox.SetText("secret"); textbox.TextChanged += OnEdit; } { Control.TextBox textbox = new Control.TextBox(vlayout2); textbox.Margin = Margin.Five; textbox.SetText("Select All Text On Focus"); textbox.SelectAllOnFocus = true; } { Control.TextBox textbox = new Control.TextBox(vlayout2); textbox.Margin = Margin.Five; textbox.SetText("Different Coloured Text, for some reason"); textbox.TextColor = Color.Green; } { Control.TextBox textbox = new Control.TextBoxNumeric(vlayout2); textbox.Margin = Margin.Five; textbox.SetText("200456698"); textbox.TextColor = Color.Red; } } /* Multiline Textbox */ { Control.MultilineTextBox textbox = new Control.MultilineTextBox(dockLayout); textbox.Dock = Dock.Fill; textbox.Margin = Margin.Five; textbox.Font = m_Font1; textbox.AcceptTabs = true; textbox.SetText("In olden times when wishing still helped one, there lived a king whose daughters were all beautiful,\nbut the youngest was so beautiful that the sun itself, which has seen so much, \nwas astonished whenever it shone in her face. \nClose by the king's castle lay a great dark forest, \nand under an old lime-tree in the forest was a well, and when the day was very warm, \nthe king's child went out into the forest and sat down by the side of the cool fountain, \nand when she was bored she took a golden ball, and threw it up on high and caught it, \nand this ball was her favorite plaything."); } { Control.Button pad = new Control.Button(dockLayout); pad.Dock = Dock.Right; pad.Margin = Margin.Five; pad.Text = "Pad"; pad.Clicked += (s, a) => new TextPad(this); } } { Control.TextBox textbox = new Control.TextBox(vlayout); textbox.Margin = Margin.Five; textbox.SetText("In olden times when wishing still helped one, there lived a king whose daughters were all beautiful, but the youngest was so beautiful that the sun itself, which has seen so much, was astonished whenever it shone in her face. Close by the king's castle lay a great dark forest, and under an old lime-tree in the forest was a well, and when the day was very warm, the king's child went out into the forest and sat down by the side of the cool fountain, and when she was bored she took a golden ball, and threw it up on high and caught it, and this ball was her favorite plaything."); textbox.TextColor = Color.Black; textbox.Font = m_Font3; } { Control.TextBox textbox = new Control.TextBox(vlayout); textbox.Margin = Margin.Five; textbox.Width = 150; textbox.HorizontalAlignment = HorizontalAlignment.Right; textbox.SetText("あおい うみから やってきた"); textbox.TextColor = Color.Black; textbox.Font = m_Font3; } { Control.TextBox textbox = new Control.TextBox(vlayout); textbox.Margin = Margin.Five; textbox.HorizontalAlignment = HorizontalAlignment.Left; textbox.FitToText = "Fit the text"; textbox.SetText("FitToText"); textbox.TextColor = Color.Black; textbox.Font = m_Font3; } { Control.TextBox textbox = new Control.TextBox(vlayout); textbox.Margin = Margin.Five; textbox.HorizontalAlignment = HorizontalAlignment.Left; textbox.Width = 200; textbox.SetText("Width = 200"); textbox.TextColor = Color.Black; textbox.Font = m_Font3; } { Control.TextBox textbox = new Control.TextBox(vlayout); textbox.Margin = Margin.Five; textbox.SetText("Different Font"); textbox.Font = m_Font2; } } }
void OnEdit(ControlBase control) { Control.TextBox box = control as Control.TextBox; UnitPrint(String.Format("TextBox: OnEdit: {0}", box.Text)); }
public TextBox(ControlBase parent) : base(parent) { int row = 0; m_Font1 = new Font(Skin.Renderer, "Consolas", 14); // fixed width font! m_Font2 = new Font(Skin.Renderer, "Impact", 50); m_Font3 = new Font(Skin.Renderer, "Arial", 14); { Control.TextBox label = new Control.TextBox(this); label.SetText("Type something here"); label.SetPosition(10, 10 + 25 * row); label.TextChanged += OnEdit; label.SubmitPressed += OnSubmit; row++; } { Control.TextBoxPassword label = new Control.TextBoxPassword(this); //label.MaskCharacter = '@'; label.SetText("secret"); label.TextChanged += OnEdit; label.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("Select All Text On Focus"); label.SetPosition(10, 10 + 25 * row); label.SelectAllOnFocus = true; row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("Different Coloured Text, for some reason"); label.TextColor = Color.ForestGreen; label.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox label = new Control.TextBoxNumeric(this); label.SetText("200456698"); label.TextColor = Color.LightCoral; label.SetPosition(10, 10 + 25 * row); row++; } row++; { Control.TextBox label = new Control.TextBox(this); label.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText(".............................................................."); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("public override void SetText(string str, bool doEvents = true)"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("あおい うみから やってきた"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } row++; { Control.TextBox label = new Control.TextBox(this); label.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText(".............................................................."); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("public override void SetText(string str, bool doEvents = true)"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("あおい うみから やってきた"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } row++; { Control.TextBox label = new Control.TextBox(this); label.SetText("Different Font (autosized)"); label.SetPosition(10, 10 + 28 * row); label.Font = m_Font2; label.SizeToContents(); row += 2; } }
public TextBox(ControlBase parent) : base(parent) { int row = 0; m_Font1 = new Font(Skin.Renderer, "Consolas", 14); // fixed width font! m_Font2 = new Font(Skin.Renderer, "Impact", 50); m_Font3 = new Font(Skin.Renderer, "Arial", 14); { Control.TextBox label = new Control.TextBox(this); label.SetText("Type something here"); label.SetPosition(10, 10 + 25 * row); label.TextChanged += OnEdit; label.SubmitPressed += OnSubmit; row++; } { Control.TextBoxPassword label = new Control.TextBoxPassword(this); //label.MaskCharacter = '@'; label.SetText("secret"); label.TextChanged += OnEdit; label.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("Select All Text On Focus"); label.SetPosition(10, 10 + 25 * row); label.SelectAllOnFocus = true; row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("Different Coloured Text, for some reason"); label.TextColor = Color.ForestGreen; label.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox label = new Control.TextBoxNumeric(this); label.SetText("200456698"); label.TextColor = Color.LightCoral; label.SetPosition(10, 10 + 25 * row); row++; } row++; { Control.TextBox label = new Control.TextBox(this); label.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText(".............................................................."); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("public override void SetText(string str, bool doEvents = true)"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("あおい うみから やってきた"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font3; label.SizeToContents(); row++; } row++; { Control.TextBox label = new Control.TextBox(this); label.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText(".............................................................."); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("public override void SetText(string str, bool doEvents = true)"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } { Control.TextBox label = new Control.TextBox(this); label.SetText("あおい うみから やってきた"); label.TextColor = Color.Black; label.SetPosition(10, 10 + 28 * row); label.Font = m_Font1; label.SizeToContents(); row++; } row++; { Control.TextBox label = new Control.TextBox(this); label.SetText("Different Font (autosized)"); label.SetPosition(10, 10 + 28 * row); label.Font = m_Font2; label.SizeToContents(); row += 2; } }
public TextBox(Base parent) : base(parent) { int row = 0; m_Font1 = new Font(Skin.Renderer, "Consolas", 14); // fixed width font! m_Font2 = new Font(Skin.Renderer, "Impact", 50); m_Font3 = new Font(Skin.Renderer, "Arial", 14); /* Vanilla Textbox */ { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Type something here"); textbox.SetPosition(10, 10 + 25 * row); textbox.TextChanged += OnEdit; textbox.SubmitPressed += OnSubmit; row++; } /* Multiline Textbox */ { Control.MultilineTextBox textbox = new Control.MultilineTextBox(this); textbox.Font = m_Font1; textbox.AcceptTabs = true; textbox.SetText("using System;\npublic class Test {\n\tpublic static void Main(){\n\t\tConsole.WriteLine(\"Hello World\");\n\t}\n}"); textbox.SetPosition(220, 10); textbox.SetSize(500, 150); } { Control.TextBoxPassword textbox = new Control.TextBoxPassword(this); //textbox.MaskCharacter = '@'; textbox.SetText("secret"); textbox.TextChanged += OnEdit; textbox.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Select All Text On Focus"); textbox.SetPosition(10, 10 + 25 * row); textbox.SelectAllOnFocus = true; row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Different Coloured Text, for some reason"); textbox.TextColor = Color.ForestGreen; textbox.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox textbox = new Control.TextBoxNumeric(this); textbox.SetText("200456698"); textbox.TextColor = Color.LightCoral; textbox.SetPosition(10, 10 + 25 * row); row++; } row++; { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText(".............................................................."); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("public override void SetText(string str, bool doEvents = true)"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("あおい うみから やってきた"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } row++; { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText(".............................................................."); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("public override void SetText(string str, bool doEvents = true)"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("あおい うみから やってきた"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } row++; { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Different Font (autosized)"); textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font2; textbox.SizeToContents(); row += 2; } }
public TextBox(Base parent) : base(parent) { int row = 0; m_Font1 = new Font(Skin.Renderer, "Consolas", 14); // fixed width font! m_Font2 = new Font(Skin.Renderer, "Impact", 50); m_Font3 = new Font(Skin.Renderer, "Arial", 14); /* Vanilla Textbox */ { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Type something here"); textbox.SetPosition(10, 10 + 25 * row); textbox.TextChanged += OnEdit; textbox.SubmitPressed += OnSubmit; row++; } /* Multiline Textbox */ { Control.MultilineTextBox textbox = new Control.MultilineTextBox(this); textbox.Font = m_Font1; textbox.AcceptTabs = true; textbox.SetText( "using System;\npublic class Test {\n\tpublic static void Main(){\n\t\tConsole.WriteLine(\"Hello World\");\n\t}\n}"); textbox.SetPosition(220, 10); textbox.SetSize(500, 150); } { Control.TextBoxPassword textbox = new Control.TextBoxPassword(this); //textbox.MaskCharacter = '@'; textbox.SetText("secret"); textbox.TextChanged += OnEdit; textbox.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Select All Text On Focus"); textbox.SetPosition(10, 10 + 25 * row); textbox.SelectAllOnFocus = true; row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Different Coloured Text, for some reason"); textbox.TextColor = Color.ForestGreen; textbox.SetPosition(10, 10 + 25 * row); row++; } { Control.TextBox textbox = new Control.TextBoxNumeric(this); textbox.SetText("200456698"); textbox.TextColor = Color.LightCoral; textbox.SetPosition(10, 10 + 25 * row); row++; } row++; { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText(".............................................................."); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("public override void SetText(string str, bool doEvents = true)"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("あおい うみから やってきた"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font3; textbox.SizeToContents(); row++; } row++; { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText(".............................................................."); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("public override void SetText(string str, bool doEvents = true)"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("あおい うみから やってきた"); textbox.TextColor = Color.Black; textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font1; textbox.SizeToContents(); row++; } row++; { Control.TextBox textbox = new Control.TextBox(this); textbox.SetText("Different Font (autosized)"); textbox.SetPosition(10, 10 + 28 * row); textbox.Font = m_Font2; textbox.SizeToContents(); row += 2; } }