diff --git a/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs b/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs index d420d518..18b6591e 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.Designer.cs @@ -41,6 +41,7 @@ namespace Volian.Controls.Library this.tbROValue = new DevComponents.DotNetBar.Controls.TextBoxX(); this.lblROValue = new DevComponents.DotNetBar.LabelX(); this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); + this.lbFound = new System.Windows.Forms.ListBox(); this.panelValue.SuspendLayout(); this.pnlROButtons.SuspendLayout(); this.panelRoValue.SuspendLayout(); @@ -50,9 +51,9 @@ namespace Volian.Controls.Library // this.tvROFST.Dock = System.Windows.Forms.DockStyle.Fill; this.tvROFST.HideSelection = false; - this.tvROFST.Location = new System.Drawing.Point(0, 99); + this.tvROFST.Location = new System.Drawing.Point(0, 233); this.tvROFST.Name = "tvROFST"; - this.tvROFST.Size = new System.Drawing.Size(233, 408); + this.tvROFST.Size = new System.Drawing.Size(233, 274); this.tvROFST.TabIndex = 5; this.tvROFST.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvROFST_BeforeExpand); this.tvROFST.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvROFST_AfterSelect); @@ -74,7 +75,7 @@ namespace Volian.Controls.Library this.lbROId.Dock = System.Windows.Forms.DockStyle.Left; this.lbROId.ForeColor = System.Drawing.SystemColors.Highlight; this.lbROId.Location = new System.Drawing.Point(46, 22); - this.lbROId.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.lbROId.Margin = new System.Windows.Forms.Padding(2); this.lbROId.Name = "lbROId"; this.lbROId.Size = new System.Drawing.Size(183, 23); this.superTooltip1.SetSuperTooltip(this.lbROId, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here. Double-Click to open" + @@ -86,7 +87,7 @@ namespace Volian.Controls.Library // this.labelX1.Dock = System.Windows.Forms.DockStyle.Left; this.labelX1.Location = new System.Drawing.Point(0, 22); - this.labelX1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.labelX1.Margin = new System.Windows.Forms.Padding(2); this.labelX1.Name = "labelX1"; this.labelX1.Size = new System.Drawing.Size(46, 23); this.superTooltip1.SetSuperTooltip(this.labelX1, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80))); @@ -112,7 +113,7 @@ namespace Volian.Controls.Library this.btnPreviewRO.Dock = System.Windows.Forms.DockStyle.Top; this.btnPreviewRO.Enabled = false; this.btnPreviewRO.Location = new System.Drawing.Point(0, 37); - this.btnPreviewRO.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnPreviewRO.Margin = new System.Windows.Forms.Padding(2); this.btnPreviewRO.Name = "btnPreviewRO"; this.btnPreviewRO.Size = new System.Drawing.Size(233, 19); this.superTooltip1.SetSuperTooltip(this.btnPreviewRO, new DevComponents.DotNetBar.SuperTooltipInfo("Preview", "", "This will Preview the selected RO Table, X/Y Plot, or Image.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80))); @@ -196,11 +197,23 @@ namespace Volian.Controls.Library // this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; // + // lbFound + // + this.lbFound.Dock = System.Windows.Forms.DockStyle.Top; + this.lbFound.FormattingEnabled = true; + this.lbFound.Location = new System.Drawing.Point(0, 99); + this.lbFound.Name = "lbFound"; + this.lbFound.Size = new System.Drawing.Size(233, 134); + this.lbFound.TabIndex = 8; + this.lbFound.Visible = false; + this.lbFound.SelectedValueChanged += new System.EventHandler(this.lbFound_SelectedValueChanged); + // // DisplayRO // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.tvROFST); + this.Controls.Add(this.lbFound); this.Controls.Add(this.panelValue); this.Name = "DisplayRO"; this.Size = new System.Drawing.Size(233, 507); @@ -225,5 +238,6 @@ namespace Volian.Controls.Library private DevComponents.DotNetBar.LabelX labelX1; private DevComponents.DotNetBar.LabelX lbROId; private DevComponents.DotNetBar.SuperTooltip superTooltip1; + private System.Windows.Forms.ListBox lbFound; } } diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 5d5d814b..d1b04866 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -60,10 +60,14 @@ namespace Volian.Controls.Library { if (!Visible) return; if (_MyRTB != null) + { _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged); + _MyRTB.SelectionChanged -= new EventHandler(_MyRTB_SelectionChanged); + } if (value == null) return; _MyRTB = value; _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged); + _MyRTB.SelectionChanged+=new EventHandler(_MyRTB_SelectionChanged); if (_MyRTB.MyLinkText == null) { CurROLink = null; @@ -72,6 +76,24 @@ namespace Volian.Controls.Library } } + void _MyRTB_SelectionChanged(object sender, EventArgs e) + { + lbFound.SelectionMode = SelectionMode.None; + lbFound.DataSource = null; + //Spin through ROs looking for the selected text + string lookFor = _MyRTB.SelectedText; + List children = _MyROFST.ROFSTLookup.GetRosByValue(lookFor); + if (children != null) + { + lbFound.Visible = true; + lbFound.DataSource = children.ToArray(); + lbFound.SelectionMode = SelectionMode.One; + lbFound.SelectedIndex = -1; + } + else + lbFound.Visible = false; + } + void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) { if (_MyRTB.MyLinkText == null) @@ -298,7 +320,11 @@ namespace Volian.Controls.Library //string tmpstr = _CurROLink; //int sp = tmpstr.IndexOf(" "); // because parse of ro info is wrong!! //int rousageid = System.Convert.ToInt32(tmpstr.Substring(0, sp)); - string roid = _CurROLink.ROID; // tmpstr.Substring(sp + 1, tmpstr.Length - sp - 1); + ExpandTree(_CurROLink.ROID);// tmpstr.Substring(sp + 1, tmpstr.Length - sp - 1); + } + + private void ExpandTree(string roid) + { string db = roid.Substring(0, 4); bool multValSel = false; if (roid.Length == 16) @@ -310,7 +336,7 @@ namespace Volian.Controls.Library int myid = rochld.ID; while (myid > 0) { - path.Insert(0,myid); + path.Insert(0, myid); myid = rochld.ParentID; rochld = MyROFST.ROFSTLookup.GetRoChildFromID(myid); if (rochld.ID == -1) myid = -1; @@ -352,9 +378,9 @@ namespace Volian.Controls.Library if (tnExpand != null) { - // If a multiple return value, try to select the proper node - if (multValSel) - { + // If a multiple return value, try to select the proper node + if (multValSel) + { LoadChildren(tnExpand); tnExpand.Expand(); foreach (TreeNode tn in tnExpand.Nodes) @@ -366,8 +392,8 @@ namespace Volian.Controls.Library break; } } - } - tvROFST.SelectedNode = tnExpand; + } + tvROFST.SelectedNode = tnExpand; } } private void btnSaveRO_Click(object sender, EventArgs e) @@ -807,5 +833,14 @@ namespace Volian.Controls.Library System.Diagnostics.Process.Start(roapp, roloc + " " + CurROLink.ROID); } #endregion + + private void lbFound_SelectedValueChanged(object sender, EventArgs e) + { + ROFSTLookup.roChild child = lbFound.SelectedValue as ROFSTLookup.roChild; + if (child != null) + { + ExpandTree(child.MyChild.roid); + } + } } }