[Mono-winforms-list] Add missing Find Method to TreeNodeCollection.
Miguel de Icaza
miguel at ximian.com
Tue Jun 5 17:19:52 EDT 2007
Hello Neil,
Your patch was reformatted by your mail program, could you resend as
an attachment?
Miguel.
> Adding some of the missing methods our application relies on.
>
>
>
> Index: /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
>
> ===================================================================
>
> --- /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs (revision 78512)
>
> +++ /home/neilcawse/mymono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs (working copy)
>
> @@ -25,6 +25,7 @@
>
>
>
> using System;
>
> using System.Collections;
>
> +using System.Collections.Generic;
>
> using System.ComponentModel;
>
> using System.Globalization;
>
>
>
> @@ -434,7 +435,33 @@
>
> nodes = nn;
>
> }
>
>
>
> +#if NET_2_0
>
> + public TreeNode[] Find (string key, bool
> searchAllChildren) {
>
> + List<TreeNode> results = new List<TreeNode>(0);
>
> + Find (key, searchAllChildren, this, results);
>
> + return results.ToArray();
>
> + }
>
>
>
> + private static void Find (string key, bool
> searchAllChildren, TreeNodeCollection nodes, List<TreeNode> results) {
>
> + for (int i = 0; i < nodes.Count; i++) {
>
> + TreeNode thisNode = nodes[i];
>
> + if (string.Compare(thisNode.Name, key,
> true, CultureInfo.InvariantCulture) == 0) {
>
> + results.Add(thisNode);
>
> + }
>
> + }
>
> + // Need to match the Microsoft order.
>
> + if (searchAllChildren) {
>
> + for (int i = 0; i < nodes.Count; i++) {
>
> + TreeNodeCollection childNodes =
> nodes[i].Nodes;
>
> + if (childNodes.Count > 0) {
>
> + Find(key,
> searchAllChildren, childNodes, results);
>
> + }
>
> + }
>
> + }
>
> + }
>
> +#endif
>
> +
>
> +
>
> internal class TreeNodeEnumerator : IEnumerator {
>
>
>
> private TreeNodeCollection collection;
>
>
> _______________________________________________
> Mono-winforms-list maillist - Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
More information about the Mono-winforms-list
mailing list