Exemple #1
0
        public void buildUi(RechnermodulBibliothek.UIElement element)
        {
            if (element.getType() == RechnermodulBibliothek.UIElement.TYPE_SINGLE)
            {
                int delta_y = panel_array.Height;
                panel_array.Visible = false;
                eingabePanel.Top   -= delta_y;
            }

            lb_param_name.Text = element.getDescription();

            this.element = element;
        }
Exemple #2
0
        public void buildUi(RechnermodulBibliothek.UIBuilderInterface uiBuilder)
        {
            this.elements = uiBuilder.getUIElements();

            int y = 0;

            for (int i = 0; i < this.elements.Length; i++)
            {
                RechnermodulBibliothek.UIElement element = this.elements[i];
                Label label = new Label();
                label.Text     = element.getDescription();
                label.Name     = "l_" + element.getKey();
                label.AutoSize = true;
                label.Top      = y;
                label.Show();
                funktionsPanel.Controls.Add(label);
                y += 20;

                if (element.getType() == RechnermodulBibliothek.UIElement.TYPE_SINGLE)
                {
                    TextBox tb = new TextBox();
                    tb.Name  = "tb_" + element.getKey();
                    tb.Left  = 0;
                    tb.Width = funktionsPanel.Width - 20;
                    tb.Top   = y;
                    tb.Show();
                    tb.Validating += (sender, e) => { this.validate_single_entry(tb, element.getModifiers()); };
                    funktionsPanel.Controls.Add(tb);
                    y += 25;
                }
                else
                {
                    Button  btn_add = new Button();
                    Button  btn_rm  = new Button();
                    TextBox tb_new  = new TextBox();
                    ListBox lb      = new ListBox();

                    tb_new.Name        = "tb_" + element.getKey();
                    tb_new.Top         = y;
                    tb_new.Left        = 50;
                    tb_new.Width       = funktionsPanel.Width - 75;
                    tb_new.Validating += (sender, e) => { this.validate_single_entry(tb_new, element.getModifiers()); };
                    tb_new.Show();

                    btn_add.Text   = "Add";
                    btn_add.Left   = 0;
                    btn_add.Top    = y + (tb_new.Height - btn_add.Height) / 2;
                    btn_add.Width  = 40;
                    btn_add.Click += (sender, e) => this.add_clicked(element.getKey(), element.getModifiers());
                    btn_add.Show();

                    btn_rm.Text   = "Del";
                    btn_rm.Left   = 0;
                    btn_rm.Top    = y + 30;
                    btn_rm.Width  = 40;
                    btn_rm.Click += (sender, e) => this.del_clicked(element.getKey());
                    btn_rm.Show();

                    lb.Name   = "lb_" + element.getKey();
                    lb.Top    = y + 30;
                    lb.Left   = tb_new.Left;
                    lb.Width  = tb_new.Width;
                    lb.Height = 100;
                    y        += 130;

                    funktionsPanel.Controls.Add(btn_add);
                    funktionsPanel.Controls.Add(btn_rm);
                    funktionsPanel.Controls.Add(tb_new);
                    funktionsPanel.Controls.Add(lb);
                }
            }
            funktionsPanel.Height = y;

            eingabePanel.Top = y + 50;
            this.Size        = new Size(this.Size.Width, eingabePanel.Height + funktionsPanel.Height + 50);
        }