Profile Picture

NTreeList - ownerdraw node

Posted By Craig Swearingen 12 Years Ago
Author
Message
Craig Swearingen
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 99, Visits: 654

I've been taking advantage of the NTreeList and its been quite nice to have available.  I've created multiple tree lists that show grid like information like the Nevron C# examples program shows.

Now, I'd like to show a node always at the bottom of my NTreeList (independent of the current sorted column) that contains tree list column summary and application state information.  Some of this nodes data will need to cross multiple columns on the tree and others as totals will line up with the subitem column its totalling.  Basically, like a report might show.  Is there any feature in the NTreeList that could help me do this?

I noticed that the NTreeList has a Note feature on a Node but I don't believe this will allow me to accomplish the above.  I did see that the NListView has an owner draw capability.  It appears to offer ownerdraw capabilities that I could use for a special node like the one I described above but of course I'd lose all the great features found in the NTreeList if I switch to it.  I've looked and I can't tell that the NTreeList offers ownerdraw features.  Given the NTreeList sits on top of the NTreeViewEx I suspect its an ownerdraw on top of it and thus ownerdraw is not exposed on the NTreeList.  Is there a way to ownerdraw a node in an NTreeList?

Thanks for any suggestions on doing something like this.



Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hello Craig,

From what I read, I guess the task is to freeze a specified node to be always at the bottom, no matter which column is sorted.

Notes in this control are related to the nodes and you cannot place a note at the bottom regardless from the nodes.
Custom rendering of the nodes gives the ability to draw the nodes by yourself but it cannot change their location into the tree list.

If the data of your tree list is not bound to a data source I can suggest one approach which can freeze a node to be always at the bottom of your nodes list when sort by a different columns:

Cache the node that you want to be at the bottom so it can be accessed into the whole class or set its Name property so you can filter all nodes by name and find the bottom node. In this case all nodes must have Name property set to some value

Attach to NTreeList.ColumnNotify event and in the event handler do the following:

void nTreeList1_ColumnNotify(object sender, NTreeListColumnNotifyData data)
{
   if (data.NotifyCode == NTreeList.ColumnSortingNotifyCode)
   {
      NTreeNodeNameFilter filter = new NTreeNodeNameFilter(bottomNodeName); //bottomNodeName is a string which represents the name of the bottom node.
      ArrayList foundNodes = nTreeList1.Nodes.Filter(filter);
      if (foundNodes.Count > 0)
      {
         nodeAtTheBottom = foundNodes[0] as NTreeListNode;
      }
   }
   if (data.NotifyCode == NTreeList.ColumnSortedNotifyCode)
   {
      if (nodeAtTheBottom != null)
      {
         int index = nTreeList1.Nodes.Count - 1;
         nTreeList1.Nodes.SetIndex(nodeAtTheBottom, index);
      }
   }
}

I hope this suggestion works for you.


Best Regards,
Nevron Support Team



Craig Swearingen
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 99, Visits: 654
Yeah, my data is not bound.  I'll try the custom rendering and sort at bottom ideas you suggest.  I very much appreciate the ideas.  Thanks.



Similar Topics


Reading This Topic