This commit is contained in:
2008-03-19 12:48:07 +00:00
parent 0fa130eb77
commit e290df0fdb
5 changed files with 190 additions and 46 deletions

View File

@@ -18,8 +18,9 @@ namespace Volian.Controls.Library
{
get { return _MyROFST; }
set
{
_MyROFST = value;
{
if (!Visible) return; // don't reset anything if the form is invisible.
_MyROFST = value; // define the tree nodes based on this rofst
LoadTree();
}
}
@@ -29,26 +30,50 @@ namespace Volian.Controls.Library
get { return _CurROLink; }
set
{
_CurROLink = value;
if (_CurROLink != null)
if (!Visible) return; // don't reset anything if the form is invisible.
if (value != null) // modify - set the controls to the current ro
{
if (_CurROLink == value) return;
_CurROLink = value;
UpdateROTree();
_SavCurROLink = _CurROLink;
}
else // insert - clear out controls
{
_CurROLink = value;
tbROValue.Text = null;
tvROFST.SelectedNode = null;
}
}
}
private string _SavCurROLink;
private ItemInfo _CurItem;
public ItemInfo CurItem
{
get { return _CurItem; }
set { _CurItem = value; }
}
private DisplayRTB _MyRTB;
public DisplayRTB MyRTB
{
get { return _MyRTB; }
set { _MyRTB = value; }
set
{
if (!Visible) return;
if (_MyRTB != null)
_MyRTB.LinkChanged -= new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
if (value == null) return;
_MyRTB = value;
_MyRTB.LinkChanged += new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
if (_MyRTB.MyLinkText == null)
{
_CurROLink = null;
}
}
}
void _MyRTB_LinkChanged(object sender, LinkClickedEventArgs e)
{
if (_MyRTB.MyLinkText == null)
CurROLink = null;
else
{
DisplayLinkEventArgs tmp = new DisplayLinkEventArgs(null, e);
CurROLink = tmp.RoUsageid;
}
}
#endregion
#region Constructors
@@ -56,14 +81,6 @@ namespace Volian.Controls.Library
{
InitializeComponent();
}
//public DisplayRO(ROFST rofst, ItemInfo curitm, bool modify, DisplayRTB rtb)
//{
// _MyROFST = rofst;
// _CurItem = curitm;
// _MyRTB = rtb;
// InitializeComponent();
// LoadTree();
//}
#endregion
#region Events
private void tvROFST_AfterSelect(object sender, TreeViewEventArgs e)
@@ -113,7 +130,9 @@ namespace Volian.Controls.Library
// if this is a group, i.e. type 0, add a dummy node
if (chld[i].type == 0 && chld[i].children == null)
//skip it.
Console.WriteLine("ro junk");
// TODO: KBR how to handle this?
//Console.WriteLine("ro junk");
continue;
else if (chld[i].type == 1 && chld[i].value == null)
{
tmp = new TreeNode(chld[i].title);
@@ -135,6 +154,7 @@ namespace Volian.Controls.Library
{
if (_MyROFST == null) return;
if (_MyROFST == _CurROFST) return;
tvROFST.Nodes.Clear();
_CurROFST = _MyROFST;
for (int i = 0; i < _MyROFST.myHdr.myDbs.Length; i++)
{
@@ -223,12 +243,11 @@ namespace Volian.Controls.Library
_MyRTB.InsertRO(tbROValue.Text, linktxt);
}
}
#endregion
private void btnCancelRO_Click(object sender, EventArgs e)
{
_CurROLink = _SavCurROLink;
UpdateROTree();
}
#endregion
}
}