Пример #1
0
 /// <summary>
 /// Sets the property value.
 /// </summary>
 /// <param name="value">Value to set.</param>
 /// <param name="fireEvents">Determines whether to fire "value changed" event.</param>
 public override void SetValue(OpenTK.Vector3 value, bool fireEvents = false)
 {
     posX.SetText(value.X, fireEvents);
     posY.SetText(value.Y, fireEvents);
     posZ.SetText(value.Z, fireEvents);
 }
Пример #2
0
        public TextBoxTest(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 */
                        {
                            TextBox textbox = new TextBox(vlayout2);
                            textbox.Margin = Margin.Five;
                            textbox.SetText("Type something here");
                            textbox.TextChanged   += OnEdit;
                            textbox.SubmitPressed += OnSubmit;
                        }

                        {
                            TextBoxPassword textbox = new TextBoxPassword(vlayout2);
                            textbox.Margin = Margin.Five;
                            //textbox.MaskCharacter = '@';
                            textbox.SetText("secret");
                            textbox.TextChanged += OnEdit;
                        }

                        {
                            TextBox textbox = new TextBox(vlayout2);
                            textbox.Margin = Margin.Five;
                            textbox.SetText("Select All Text On Focus");
                            textbox.SelectAllOnFocus = true;
                        }

                        {
                            TextBox textbox = new TextBox(vlayout2);
                            textbox.Margin = Margin.Five;
                            textbox.SetText("Different Coloured Text, for some reason");
                            textbox.TextColor = Color.Green;
                        }

                        {
                            TextBox textbox = new TextBoxNumeric(vlayout2);
                            textbox.Margin = Margin.Five;
                            textbox.SetText("200456698");
                            textbox.TextColor = Color.Red;
                        }
                    }

                    /* Multiline Textbox */
                    {
                        MultilineTextBox textbox = new 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.");
                    }
                    {
                        Button pad = new Button(dockLayout);
                        pad.Dock     = Dock.Right;
                        pad.Margin   = Margin.Five;
                        pad.Text     = "Pad";
                        pad.Clicked += (s, a) => new TextPad(this);
                    }
                }

                {
                    TextBox textbox = new 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;
                }

                {
                    TextBox textbox = new TextBox(vlayout);
                    textbox.Margin = Margin.Five;
                    textbox.Width  = 150;
                    textbox.HorizontalAlignment = HorizontalAlignment.Right;
                    textbox.SetText("あおい うみから やってきた");
                    textbox.TextColor = Color.Black;
                    textbox.Font      = m_Font3;
                }

                {
                    TextBox textbox = new 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;
                }

                {
                    TextBox textbox = new 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;
                }

                {
                    TextBox textbox = new TextBox(vlayout);
                    textbox.Margin = Margin.Five;
                    textbox.SetText("Different Font");
                    textbox.Font = m_Font2;
                }
            }
        }