Search through an UltraWinTree and Select Nodes

You are amazing!!!

I don't understand a lot of this code, but it is working on the JE screen for me as well.  Thank you Jose!

I was hoping for some help with an UltraWinTree.  I have a searchbox on the JobEntry screen that the user enters in a string.  Beside it I have a button, that when clicked needs to search through EACH node in the UltraWinTree and stop and select the FIRST node where there is a match between the string entered and the Node's Key/Text.  After that, when the user clicks the button again, the search goes to the NEXT instance where there is a match between the string entered and the Node's Key/Text.


I have been met with a ton of issues trying to do this and I have some questions that I am hoping the users group could answer.


1.) Is there a way to expand ALL (each an every single node) within the tree?  I have tried multiple ways to do this, but all result in the same thing:  the tree is expanded, but the childnodes within the tree are not.  So if there are multiple Assemblies in the Job the Job opens up Assembly 0 and expands all of those nodes, but the rest of the Assemblies are still collapsed.  Basically, I need to code in exactly what the screen does when you Right click on the Root node and select Tree --> Expand Tree.


2.) The code below selects the LAST value that matches the Search Text in the box.  I need it to find and select the FIRST value and then step through EACH match as the user clicks the search button.


Private Sub btnSrch_Click(ByVal sender As Object, ByVal args As System.EventArgs)

Dim rootNode As Infragistics.Win.UltraWinTree.UltraTreeNode

For Each rootNode In Me.theJobTree.Nodes

SearchNodes(rootNode)

Next

End Sub


Private Sub SearchNodes(ByVal node As Infragistics.Win.UltraWinTree.UltraTreeNode)

Dim srchVal As String = txtbxSrch.Value.ToUpper()

Dim childNode As Infragistics.Win.UltraWinTree.UltraTreeNode


If node.Text <> "" AndAlso srchVal <> "" Then

If node.Text.StartsWith("Mtl: ") Then

If node.Text.ToUpper().Contains(srchVal) Then

theJobTree.ActiveNode = node

theJobTree.ActiveNode.Selected = True

theJobTree.Select()

theJobTree.HideSelection = False

End If

End If

End If


For Each childNode In node.Nodes

IterateNodes(childNode)

Next

End Sub


Thanks for any/all help... this one has me lost.

Has anyone had success expanding each node in the treeview with code?

Thanks!


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Nov 3, 2014 at 12:37 PM, chan213419@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Has anyone had success expanding each node in the treeview with code?</p>

</div><span class="ygrps-yiv-566627931">
 


<div style="color:#fff;min-height:0;"></div>


Hahaha Yes!  That Google thing cracks me up!

Unfortunately though I've tried this and it's not working for me.

The code, "node.ExpandAll(ExpandAllType.Always)" expands all of the rootNodes and the ChildNodes of the RootNode, but it does not get the childen's children.  I really wish we could include screenshots in here... here's the best way I can explain it.

RootNode: JobNum - 12345  <-- Displays/Expands correctly

Assembly 0 <-- Displays/Expands Correctly

Subassemblies <-- Displays/Expands Correctly

Assembly 1 <-- Expanded, but does NOT show the childnodes within this SubAssembly.  In another words, there are nodes within this node that are not being shown nor expanded.  When I manually expand this node, without code, I see the + sign next to Operations and Materials, and I see that there are additional nodes in there.  When this same node is expanded with this code there is no + sign.  So the code apparently doesn't recognize this as an expandable node with data in it or something.

Assembly 2 <-- Same as above.

Operations <-- Displays/Expands Correctly

Resources <-- Displays/Expands Correctly

Materials <-- Displays/Expands Correctly

So it hits and expands everything, but the SubAssemblies, when expanded show that there are no additional nodes nor data within these nodes (when they definitely should).

Any other ideas?  Am I explaining this well?
Well there's 3 hours of my life I won't get back... I'll send you the bill. This works in JobEntry 9.05 7.02.A

using System.Reflection;
using System.Text;

MethodInfo miT = typeof(Convert).GetMethod("FromBase64String", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
byte[] arr = (byte[])miT.Invoke(null,new object[]{"am9iVHJlZQ=="});
FieldInfo fi = oTrans.GetType().GetField(Encoding.UTF8.GetString(arr),BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
MethodTree mt = (MethodTree) fi.GetValue(oTrans);
arr = (byte[])miT.Invoke(null,new object[]{"Y21FeHBhbmRUcmVl"});
MethodInfo mi = mt.GetType().GetMethod(Encoding.UTF8.GetString(arr), BindingFlags.NonPublic | BindingFlags.Instance);
mi.Invoke(mt, new object[]{this, new EventArgs()});


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Nov 3, 2014 at 5:09 PM, chan213419@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Hahaha Yes!  That Google thing cracks me up!</p><div><br></div><div>Unfortunately though I&#39;ve tried this and it&#39;s not working for me.</div><div><br></div><div>The code, &quot;<span style="word-spacing:normal;font-size:13px;">node.ExpandAll(ExpandAllType.Always)&quot; </span><span style="word-spacing:normal;font-size:13px;">expands all of the rootNodes and the ChildNodes of the RootNode, but it does not get the childen&#39;s children.  I really wish we could include screenshots in here... here&#39;s the best way I can explain it.</span></div><div><span style="word-spacing:normal;font-size:13px;"><br></span></div><div>RootNode: JobNum - 12345  &lt;-- Displays/Expands correctly</div><div><br></div><div>Assembly 0 &lt;-- Displays/Expands Correctly</div><div><br></div><div><span style="font-size:12.8000001907349px;">Subassemblies &lt;-- </span><span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span><br></div><div><span style="font-size:12.8000001907349px;"><br></span></div><div><span style="word-spacing:normal;font-size:13px;">Assembly 1 &lt;-- Expanded, but does NOT show the childnodes within this SubAssembly.  In another words, there are nodes within this node that are not being shown nor expanded.  When I manually expand this node, without code, I see the + sign next to Operations and Materials, and I see that there are additional nodes in there.  When this same node is expanded with this code there is no + sign.  So the code apparently doesn&#39;t recognize this as an expandable node with data in it or something.</span><br></div><div><span style="word-spacing:normal;font-size:13px;"><br></span></div><div>Assembly 2 &lt;-- Same as above.</div><div><br></div><div>Operations &lt;-- <span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span></div><div><br></div><div>Resources &lt;-- <span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span></div><div><br></div><div>Materials &lt;-- <span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span></div><div><br></div><div>So it hits and expands everything, but the SubAssemblies, when expanded show that there are no additional nodes nor data within these nodes (when they definitely should).</div><div><br></div><div>Any other ideas?  Am I explaining this well?</div><p></p>

</div><span class="ygrps-yiv-1556800187">
 


<div style="color:#fff;min-height:0;"></div>


Also addÂ
using Epicor.Mfg.UI.FrameWork.JobLib;



Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Nov 3, 2014 at 9:10 PM, Jose Gomez <jose@...> wrote:
Well there's 3 hours of my life I won't get back... I'll send you the bill. This works in JobEntry 9.05 7.02.A

using System.Reflection;
using System.Text;

MethodInfo miT = typeof(Convert).GetMethod("FromBase64String", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
byte[] arr = (byte[])miT.Invoke(null,new object[]{"am9iVHJlZQ=="});
FieldInfo fi = oTrans.GetType().GetField(Encoding.UTF8.GetString(arr),BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
MethodTree mt = (MethodTree) fi.GetValue(oTrans);
arr = (byte[])miT.Invoke(null,new object[]{"Y21FeHBhbmRUcmVl"});
MethodInfo mi = mt.GetType().GetMethod(Encoding.UTF8.GetString(arr), BindingFlags.NonPublic | BindingFlags.Instance);
mi.Invoke(mt, new object[]{this, new EventArgs()});


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Nov 3, 2014 at 5:09 PM, chan213419@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>Hahaha Yes!  That Google thing cracks me up!</p><div><br></div><div>Unfortunately though I&#39;ve tried this and it&#39;s not working for me.</div><div><br></div><div>The code, &quot;<span style="word-spacing:normal;font-size:13px;">node.ExpandAll(ExpandAllType.Always)&quot; </span><span style="word-spacing:normal;font-size:13px;">expands all of the rootNodes and the ChildNodes of the RootNode, but it does not get the childen&#39;s children.  I really wish we could include screenshots in here... here&#39;s the best way I can explain it.</span></div><div><span style="word-spacing:normal;font-size:13px;"><br></span></div><div>RootNode: JobNum - 12345  &lt;-- Displays/Expands correctly</div><div><br></div><div>Assembly 0 &lt;-- Displays/Expands Correctly</div><div><br></div><div><span style="font-size:12.8000001907349px;">Subassemblies &lt;-- </span><span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span><br></div><div><span style="font-size:12.8000001907349px;"><br></span></div><div><span style="word-spacing:normal;font-size:13px;">Assembly 1 &lt;-- Expanded, but does NOT show the childnodes within this SubAssembly.  In another words, there are nodes within this node that are not being shown nor expanded.  When I manually expand this node, without code, I see the + sign next to Operations and Materials, and I see that there are additional nodes in there.  When this same node is expanded with this code there is no + sign.  So the code apparently doesn&#39;t recognize this as an expandable node with data in it or something.</span><br></div><div><span style="word-spacing:normal;font-size:13px;"><br></span></div><div>Assembly 2 &lt;-- Same as above.</div><div><br></div><div>Operations &lt;-- <span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span></div><div><br></div><div>Resources &lt;-- <span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span></div><div><br></div><div>Materials &lt;-- <span style="font-size:12.8000001907349px;word-spacing:normal;">Displays/Expands Correctly</span></div><div><br></div><div>So it hits and expands everything, but the SubAssemblies, when expanded show that there are no additional nodes nor data within these nodes (when they definitely should).</div><div><br></div><div>Any other ideas?  Am I explaining this well?</div><p></p>

</div><span>
 


<div style="color:#fff;min-height:0;"></div>