Added code to lookup selected text in the value field of the RO Database
This commit is contained in:
@@ -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<ROFSTLookup.roChild> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user