Пример #1
0
        public void SizeControl(AubitDesktop.Xml.XMLForm.Matrix ma, int index, Control c)
        {
            // int coffset = 0;
            c.Height = GuiLayout.get_gui_h(_rows);
            if (_columns > 2 || true)
            {
                c.Width = GuiLayout.get_gui_w(_columns + 1);
                //  coffset = 1;
            }
            else
            {
                c.Width = GuiLayout.get_gui_w(3);
            }

            if (configSettings.ContainsKey("HEIGHT"))
            {
                c.Height = GuiLayout.get_gui_h(Convert.ToInt32((string)configSettings["HEIGHT"]));
            }
            if (configSettings.ContainsKey("WIDTH"))
            {
                c.Width = GuiLayout.get_gui_w(Convert.ToInt32((string)configSettings["WIDTH"]));
            }


            c.Visible = true;

            c.Location = GuiLayout.getPoint(ma, index, _column, _row);
        }
Пример #2
0
        private void createTextWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, bool buttonEdit, string buttonImage)
        {
            int bcol       = 0;
            int totalWidth = 0;

            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p = new Panel();
            //lblInsteadOfTxtBox = new Label();
            p.BorderStyle = BorderStyle.None;

            /*
             * if (rows > 1)
             * {
             *  lblInsteadOfTxtBox.TextAlign = ContentAlignment.TopLeft;
             * }
             * else
             * {
             *  lblInsteadOfTxtBox.TextAlign = ContentAlignment.MiddleLeft;
             * } */

            t = new System.Windows.Forms.TextBox();
            if (thisAttribute.ATTRIB_INVISIBLE != null)
            {
                t.PasswordChar = '*';
            }

            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);
            // lblInsteadOfTxtBox.Margin = new Padding(0, 0, 0, 0);
            //lblInsteadOfTxtBox.Padding = new Padding(0, 0, 0, 0);
            t.Margin  = new Padding(0, 0, 0, 0);
            t.Padding = new Padding(0, 0, 0, 0);

            p.Name = "TWP_" + tabcol;
            t.Name = "TWT_" + tabcol;
            // lblInsteadOfTxtBox.Name = "TWL_" + tabcol;

            if (buttonEdit)
            {
                if (configSettings["BUTTONWIDTH"] != null)
                {
                    bcol = Convert.ToInt32((string)configSettings["BUTTONWIDTH"]);
                }
                else
                {
                    bcol = 1;
                }
            }



            t.Visible = true;
            t.Enabled = true;
            SizeControl(ma, index, p);
            if (bcol > 0)
            {
                p.Size = new Size(GuiLayout.get_gui_w(columns + bcol + 1) + 5, GuiLayout.get_gui_h(rows));
            }


            if (rows > 1)
            {
                t.Multiline = true;
            }
            else
            {
                t.Multiline = false;
            }



            // Any columns used for the button must be subtracted from the length of the
            // textbox..

            // t.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));
            //l.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));

            t.Height = GuiLayout.get_gui_h(rows);


            if (columns > 2 || true)
            {
                totalWidth = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                totalWidth = GuiLayout.get_gui_w(4);
            }

            if (rows == 1)
            {
                this.MaxLength = columns;
            }
            else
            {
                this.MaxLength = columns * rows;
            }


            if (Upshift)
            {
                t.CharacterCasing = CharacterCasing.Upper;
            }

            if (Downshift)
            {
                t.CharacterCasing = CharacterCasing.Lower;
            }


            if (false)
            {
                // lblInsteadOfTxtBox.Visible = true;
                // lblInsteadOfTxtBox.BorderStyle = BorderStyle.Fixed3D;
            }

            if (buttonEdit)
            {
                b         = new Button();
                b.TabStop = false;
                if (configSettings["TEXT"] != null)
                {
                    b.Text = (string)configSettings["TEXT"];
                }
                else
                {
                    b.Text = "!";
                }

                //b.Size = new Size(GuiLayout.get_gui_w(bcol), GuiLayout.get_gui_h(rows)-4);
                b.Top = 0;

                if (bcol > 0)
                {
                    //reservedButtonWidth = bcol;
                    b.Width = GuiLayout.get_gui_w(bcol);     //NOTWEBGUI
                    //WEBGUI b.Size = new System.Drawing.Size( GuiLayout.get_gui_w(bcol+1),  GuiLayout.get_gui_h(1));
                }
                else
                {
                    //reservedButtonWidth = 1;
                    b.Width = GuiLayout.get_gui_w(1); //NOTWEBGUI
                    //WEBGUI b.Size = new System.Drawing.Size( GuiLayout.get_gui_w(2),  GuiLayout.get_gui_h(1));
                }

                if (configSettings["IMAGE"] == null)
                {
                    //WEBGUI b.Image = FGLUtils.getImageFromName("zoom.png");
                    b.Image = FGLUtils.getImageFromName("zoom"); //NOTWEBGUI
                }
                else
                {
                    b.Image = FGLUtils.getImageFromName((string)configSettings["IMAGE"]);
                }


                b.Height = b.Image.Height + 4;  // NOTWEBGUI
                b.Width  = b.Image.Width + 4;   // NOTWEBGUI
                if (b.Image.Height > t.Height)  // NOTWEBGUI
                {                               // NOTWEBGUI
                    b.Height = t.Height;        // NOTWEBGUI
                }                               // NOTWEBGUI


                if (bcol > 0)
                {
                    t.Width = totalWidth; // -(GuiLayout.get_gui_w(bcol) + 5);
                    b.Left  = totalWidth; // -b.Width;
                }
                else
                {
                    t.Width = totalWidth; //-(b.Width +5);
                    b.Left  = totalWidth; // -b.Width;
                }

                //b.Left = GuiLayout.get_gui_x(column) ;     /* thats 2 pixels - not 2 characters */
                b.Visible = true;
            }
            else
            {
                b       = null;
                t.Width = totalWidth;
            }
            p.Height = GuiLayout.get_gui_h(rows);
            // lblInsteadOfTxtBox.Left = 0;
            //lblInsteadOfTxtBox.Top = 0;
            //lblInsteadOfTxtBox.Size = t.Size;
            p.Controls.Add(t);
            // p.Controls.Add(lblInsteadOfTxtBox);
            p.AutoSize = true; //NOTWEBGUI
            if (b != null)
            {
                p.Controls.Add(b);
            }

            // p.Size = l.Size;

            t.CausesValidation = true;
            //t.KeyDown += new KeyEventHandler(t_KeyDown);
            t.KeyPress    += new KeyPressEventHandler(t_KeyPress);
            t.Validating  += new System.ComponentModel.CancelEventHandler(t_Validating);
            t.Enter       += new EventHandler(t_GotFocus);
            t.TextChanged += new EventHandler(t_TextChanged);

            // EventHandler moveNext = new EventHandler(TheMethod);

            //t.Validating += new System.ComponentModel.CancelEventHandler(t_Validating);
            if (b != null)
            {
                b.Click += new EventHandler(t_Click);
            }
            else
            {
                t.Click += new EventHandler(t_Click);
            }
            t.ReadOnly = true;
            t.Visible  = true;

            this.id          = id;
            this.ContextType = FGLContextType.ContextNone;
            adjustDisplayPropertiesForContext();
        }
Пример #3
0
        private void createComboBoxWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, AubitDesktop.Xml.XMLForm.Item[] items)
        {
            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p           = new Panel();
            l           = new Label();
            l.TextAlign = ContentAlignment.MiddleLeft;
            t           = new Gizmox.WebGUI.Forms.ComboBox();

            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);
            l.Margin  = new Padding(0, 0, 0, 0);
            l.Padding = new Padding(0, 0, 0, 0);
            t.Margin  = new Padding(0, 0, 0, 0);
            t.Padding = new Padding(0, 0, 0, 0);


            t.Visible = true;
            t.Enabled = true;
            SizeControl(ma, index, p);

            t.Size = p.Size;


            t.TextChanged += new EventHandler(t_TextChanged);

            // Any columns used for the button must be subtracted from the length of the
            // textbox..


            if (columns > 2)
            {
                t.Width = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                t.Width = GuiLayout.get_gui_w(3);
            }

            _maxLength = columns;


            l.Size = t.Size;

            /*
             * if (Upshift)
             * {
             *
             *  t.CharacterCasing = CharacterCasing.Upper;
             * }
             *
             * if (Downshift)
             * {
             *  t.CharacterCasing = CharacterCasing.Lower;
             * }
             */


            l.Visible     = true;
            l.BorderStyle = BorderStyle.Fixed3D;

            t.DropDownStyle = ComboBoxStyle.DropDownList;

            p.Controls.Add(t);
            p.Controls.Add(l);


            FGLComboEntry[] cbItems = FGLComboEntry.createItems(items);

            setItems(cbItems);

            // p.Size = l.Size;


            t.CausesValidation = true;
            t.Validating      += new System.ComponentModel.CancelEventHandler(t_Validating);
            t.Enter           += new EventHandler(t_GotFocus);
            t.Click           += new EventHandler(t_Click);
            t.Visible          = true;
            t.Enabled          = true;

            this.id = id;
        }
Пример #4
0
        /// <summary>
        /// Display a single character at an x/y location (1 based)
        /// create a label if required to do it.
        ///
        /// </summary>
        /// <param name="x">X position (1 based)</param>
        /// <param name="y">Y position (1 based)</param>
        /// <param name="s">String to display (or null to remove any existsing label)</param>
        /// <param name="attr">Numeric attribute (eg. 4096 for reverse video) </param>
        private void displayAtLabel(int x, int y, string s, int attr)
        {
            Label l;

            if (s == null)
            {
                if (backgroundLabels[x - 1, y - 1] != null)
                {
                    backgroundLabels[x - 1, y - 1].Visible = false;
                    backgroundLabels[x - 1, y - 1]         = null;
                }
                return;
            }

            if (backgroundLabels[x - 1, y - 1] == null)
            {
                l           = new Label();
                l.AutoSize  = false;
                l.Width     = GuiLayout.get_gui_w(1);
                l.Height    = GuiLayout.get_gui_h(1);
                l.Left      = GuiLayout.get_gui_x(x);
                l.Top       = GuiLayout.get_gui_y(y);
                l.TextAlign = ContentAlignment.MiddleCenter;
                l.Font      = fixedWidthFont;
                backgroundLabels[x - 1, y - 1] = l;
                this.WindowWidget.Controls.Add(backgroundLabels[x - 1, y - 1]);
                l.BringToFront();
            }
            else
            {
                l = backgroundLabels[x - 1, y - 1];
            }

            backgroundLabels[x - 1, y - 1].Text = s;
            if (this.CurrentForm != null)
            {
                l.Left = GuiLayout.get_gui_x(x);
                l.Top  = GuiLayout.get_gui_y(y);
                if (l.Left > this.CurrentForm.thisFormsPanel.Left && l.Left < this.CurrentForm.thisFormsPanel.Right)
                {
                    if (l.Top > this.CurrentForm.thisFormsPanel.Top && l.Top < this.CurrentForm.thisFormsPanel.Bottom)
                    {
                        // Its actually in the 'current' form - not the background window...
                        l.Parent = this.CurrentForm.thisFormsPanel;
                        l.Top   -= this.CurrentForm.thisFormsPanel.Top;
                        l.Left  -= this.CurrentForm.thisFormsPanel.Left;
                    }
                }
            }
            else
            {
                l.Left = GuiLayout.get_gui_x(x);
                l.Top  = GuiLayout.get_gui_y(y);
            }
            if ((attr & 4096) > 0)
            {
                backgroundLabels[x - 1, y - 1].BackColor = Color.Bisque;
            }
            else
            {
                backgroundLabels[x - 1, y - 1].BackColor = this.WindowWidget.BackColor;
            }
            backgroundLabels[x - 1, y - 1].BringToFront();
        }
Пример #5
0
        private void createTextWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, bool buttonEdit, string buttonImage)
        {
            int bcol = 0;

            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p = new Panel();

            p.BorderStyle = BorderStyle.Fixed3D;

            tNullable              = new NullableDateTimePicker();
            tNullable.Format       = DateTimePickerFormat.Custom;
            tNullable.CustomFormat = FGLUtils.DBDATEFormat_dotnet;
            tNullable.Visible      = true;
            tNullable.Enabled      = true;


            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);

            tNullable.Margin  = new Padding(0, 0, 0, 0);
            tNullable.Padding = new Padding(0, 0, 0, 0);


            tNullable.Visible = true;
            tNullable.Enabled = true;
            tNullable.Value   = null;
            SizeControl(ma, index, p);
            //p.Location = new System.Drawing.Point(GuiLayout.get_gui_x(column), GuiLayout.get_gui_y(row));
            p.AutoSize     = true;
            p.Name         = "DTPP_" + tabcol;
            tNullable.Name = "DTPT_" + tabcol;

            //t.BackColor = Color.Red;
            //l.BackColor = Color.Blue;



            // Any columns used for the button must be subtracted from the length of the
            // textbox..

            tNullable.Size = new Size(GuiLayout.get_gui_w(columns - bcol), GuiLayout.get_gui_h(rows));

            p.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));



            if (columns > 2)
            {
                tNullable.Width = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                tNullable.Width = GuiLayout.get_gui_w(3);
            }


            //t.KeyDown += new KeyEventHandler(t_KeyDown);
            //t.KeyPress += new KeyPressEventHandler(t_KeyPress);



            if (buttonEdit)
            {
                b         = new Button();
                b.TabStop = false;
                if (configSettings["TEXT"] != null)
                {
                    b.Text = (string)configSettings["TEXT"];
                }
                else
                {
                    b.Text = "!";
                }

                b.Size = new Size(GuiLayout.get_gui_w(bcol), GuiLayout.get_gui_h(rows) - 4);
                b.Top  = 0;
                if (configSettings["IMAGE"] == null)
                {
                    b.Image = FGLUtils.getImageFromName("zoom");
                }
                else
                {
                    b.Image = FGLUtils.getImageFromName((string)configSettings["IMAGE"]);
                }

                b.Left = tNullable.Width + 1;
                //b.Left = GuiLayout.get_gui_x(column) ;     /* thats 2 pixels - not 2 characters */
                b.Visible = true;
            }
            else
            {
                b = null;
            }

            p.Controls.Add(tNullable);

            if (b != null)
            {
                p.Controls.Add(b);
            }

            // p.Size = l.Size;

            tNullable.CausesValidation = true;
            tNullable.KeyDown         += new KeyEventHandler(t_KeyDown);
            tNullable.KeyPress        += new KeyPressEventHandler(t_KeyPress);
            tNullable.Validating      += new System.ComponentModel.CancelEventHandler(t_Validating);
            tNullable.Enter           += new EventHandler(t_GotFocus);
            tNullable.TextChanged     += new EventHandler(t_TextChanged);
            //t.Validating += new System.ComponentModel.CancelEventHandler(t_Validating);
            if (b != null)
            {
                b.Click += new EventHandler(t_Click);
            }
            else
            {
                tNullable.Click += new EventHandler(t_Click);
            }
            tNullable.Visible = true;

            this.id          = id;
            this.ContextType = FGLContextType.ContextNone;

            adjustDisplayPropertiesForContext();
        }