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 = FGLWebUtils.getImageFromName("zoom"); } else { b.Image = FGLWebUtils.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.KeyDown += new KeyEventHandler(t_KeyDown); tNullable.KeyPress += new KeyPressEventHandler(t_KeyPress); tNullable.Enter += new EventHandler(t_GotFocus); tNullable.TextChanged += new EventHandler(t_TextChanged); 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(); }
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(); l = new Label(); p.BorderStyle = BorderStyle.None; if (rows > 1) { l.TextAlign = ContentAlignment.TopLeft; } else { l.TextAlign = ContentAlignment.MiddleLeft; } t = new Gizmox.WebGUI.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); 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); p.Name = "TWP_" + tabcol; t.Name = "TWT_" + tabcol; l.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; } l.Visible = true; l.BorderStyle = BorderStyle.Fixed3D; //l.BackColor = Color.Red; 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.Size = new System.Drawing.Size(GuiLayout.get_gui_w(bcol + 1), GuiLayout.get_gui_h(1)); } else { //reservedButtonWidth = 1; b.Size = new System.Drawing.Size(GuiLayout.get_gui_w(2), GuiLayout.get_gui_h(1)); } if (configSettings["IMAGE"] == null) { b.Image = FGLWebUtils.getImageFromName("zoom.png"); } else { b.Image = FGLWebUtils.getImageFromName((string)configSettings["IMAGE"]); } 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); l.Left = 0; l.Top = 0; l.Size = t.Size; p.Controls.Add(t); p.Controls.Add(l); if (b != null) { p.Controls.Add(b); } // p.Size = l.Size; //t.KeyDown += new KeyEventHandler(t_KeyDown); //t.KeyPress += new KeyPressEventHandler(t_KeyPress); t.Enter += new EventHandler(t_GotFocus); t.TextChanged += new EventHandler(t_TextChanged); 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(); }
/// <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; return; 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(); }