« on: January 15, 2012, 11:35:32 AM »
Hi (again) - I am still beating on this dynamic filtering. I really need to try and get this to work as it is the best way for some of my data.
Can you tell me what is wrong with this code? The tree is set to dynamic filtering and breakpoints show me that the visibility is returned as .Visible for each of the 3 images and the bitmaps are correctly supplied when requestd in the ValueGet. There are no other nodes in the tree. On screen I get nothing except the lines from .Root to the nodes.
class TestNodeB : Node
{
public static NodeImage TreeImage = new NodeImage();
public static NodeImage StatusImage = new NodeImage();
public static NodeImage DescriptionImage = new NodeImage();
private static NodeControl[] temp = { TreeImage, StatusImage, DescriptionImage, };
public static List<NodeControl> Controls = new List<NodeControl>(temp);
public TestNodeB(Node pParentNode)
{
Text = "Test Node";
AttachTo(pParentNode);
if (!pParentNode.Treeview.NodeControls.Contains(TreeImage))
{
TreeImage.AttachTo(pParentNode.Treeview);
TreeImage.ColumnId = 0;
TreeImage.VirtualMode = true;
StatusImage.AttachTo(pParentNode.Treeview);
StatusImage.ColumnId = 3;
StatusImage.VirtualMode = true;
DescriptionImage.AttachTo(pParentNode.Treeview);
DescriptionImage.ColumnId = 5;
DescriptionImage.VirtualMode = true;
}
this.Treeview.FilterNodeControl += FilterNodeControl;
this.Treeview.NodeControlValueGet += NodeControlValueGet;
}
bool NodeControlValueGet(FlexibleTreeView pTreeview, NodeControlValueEventArgs pArgs)
{
if (pArgs.Node == this)
{
if (Controls.Contains(pArgs.NodeControl))
{
if (pArgs.NodeControl == TreeImage)
{
pArgs.Value = (pTreeview as TreeViewWithImages).Bitmaps["image_6"];
return true;
}
else if (pArgs.NodeControl == StatusImage)
{
pArgs.Value = (pTreeview as TreeViewWithImages).Bitmaps["image_7"];
return true;
}
else if (pArgs.NodeControl == DescriptionImage)
{
pArgs.Value = (pTreeview as TreeViewWithImages).Bitmaps["image_8"];
return true;
}
}
else
{
return true;
}
}
return false;
}
public void FilterNodeControl(FlexibleTreeView pTreeview, FilterNodeControlEventArgs pArgs)
{
if (pArgs.Node == this)
{
if (Controls.Contains(pArgs.NodeControl))
{
pArgs.ControlVisibility = eNodeControlVisibility.Visible;
}
else
{
pArgs.ControlVisibility = eNodeControlVisibility.Hidden;
}
}
}
}