CheckListInput addwarningcontrol(int x, int y, CheckListItem item, bool hideforchild = false) { CheckListInput wrnctl = new CheckListInput(_parent, item); wrnctl.ReloadList += wrnctl_ChildAdd; wrnctl.Location = new Point(x, y); if (hideforchild) { wrnctl.TXT_text.Visible = false; wrnctl.TXT_desc.Visible = false; wrnctl.CMB_colour1.Visible = false; wrnctl.CMB_colour2.Visible = false; } panel1.Controls.Add(wrnctl); y = wrnctl.Bottom; if (item.Child != null) { wrnctl = addwarningcontrol(x += 5, y, item.Child, true); } return wrnctl; }
private void BUT_Add_Click(object sender, EventArgs e) { var newcw = new CheckListItem(); CheckListItem.defaultsrc = MainV2.comPort.MAV.cs; newcw.SetField(newcw.GetOptions()[0]); lock (_parent.CheckListItems) { _parent.CheckListItems.Add(newcw); } reload(); }
public CheckListInput(CheckListControl parent, CheckListItem item) { _parent = parent; InitializeComponent(); CheckListItem.defaultsrc = MainV2.comPort.MAV.cs; item.SetField(item.Name); CMB_condition.DataSource = Enum.GetNames(typeof(CheckListItem.Conditional)); CMB_Source.DataSource = item.GetOptions(); CMB_colour1.DataSource = Enum.GetNames(typeof(KnownColor)); CMB_colour2.DataSource = Enum.GetNames(typeof(KnownColor)); CheckListItem = item; updateDisplay(); }
void removewarning(CheckListItem lookin, CheckListItem removeme) { // depth first check children if (lookin.Child != null) { removewarning(lookin.Child, removeme); } if (lookin.Child == removeme) { if (lookin.Child.Child != null) { lookin.Child = lookin.Child.Child; } else { lookin.Child = null; } return; } }
public bool checkCond(CheckListItem item) { // if there is a child go recursive if (item.Child != null) { if (item.CheckValue() && checkCond(item.Child)) { return(true); } } else { // is no child then simple check if (item.CheckValue()) { return(true); } } return(false); }
void removewarning(CheckListItem lookin, CheckListItem removeme) { // depth first check children if (lookin.Child != null) removewarning(lookin.Child, removeme); if (lookin.Child == removeme) { if (lookin.Child.Child != null) { lookin.Child = lookin.Child.Child; } else { lookin.Child = null; } return; } }
Control addwarningcontrol(int x, int y, CheckListItem item, bool hideforchild = false) { var desctext = item.Description; var texttext = item.DisplayText(); var height = 21; if (desctext.Length > 25 || texttext.Length > 25) height = 42; Label desc = new Label() { Text = desctext, Location = new Point(x, y), Size = new Size(150, height), Name = "udesc" + y }; Label text = new Label() { Text = texttext, Location = new Point(desc.Right, y), Size = new Size(150, height), Name = "utext" + y }; CheckBox tickbox = new CheckBox() { Checked = item.checkCond(item), Location = new Point(text.Right, y), Size = new Size(21, 21), Name = "utickbox" + y }; desc.Tag = text.Tag = tickbox.Tag = new internaldata { CLItem = item, desc = desc, text = text, tickbox = tickbox }; panel1.Controls.Add(desc); panel1.Controls.Add(text); panel1.Controls.Add(tickbox); y = desc.Bottom; if (item.Child != null) { //return addwarningcontrol(x += 5, y, item.Child, true); } return desc; }
public bool checkCond(CheckListItem item) { // if there is a child go recursive if (item.Child != null) { if (item.CheckValue() && checkCond(item.Child)) return true; } else { // is no child then simple check if (item.CheckValue()) return true; } return false; }
Control addwarningcontrol(int x, int y, CheckListItem item, bool hideforchild = false) { var desctext = item.Description; var texttext = item.DisplayText(); var height = TextRenderer.MeasureText(desctext, this.Font).Height; GroupBox gb = new GroupBox() { Text = "", Location = new Point(x,y), Size = new Size(330, 17 + height), Name = "gb" + y }; Label desc = new Label() { Text = desctext, Location = new Point(5, 9), Size = new Size(150, height), Name = "udesc" + y }; Label text = new Label() { Text = texttext, Location = new Point(desc.Right, 9), Size = new Size(150, height), Name = "utext" + y }; CheckBox tickbox = new CheckBox() { Checked = item.checkCond(item), Location = new Point(text.Right, 7), Size = new Size(21, 21), Name = "utickbox" + y }; desc.Tag = text.Tag = tickbox.Tag = new internaldata { CLItem = item, desc = desc, text = text, tickbox = tickbox }; gb.Controls.Add(desc); gb.Controls.Add(text); gb.Controls.Add(tickbox); panel1.Controls.Add(gb); y = gb.Bottom; if (item.Child != null) { //return addwarningcontrol(x += 5, y, item.Child, true); } return gb; }