Jump to content

Recommended Posts

I'm trying to create a better user interface for my tree navigation. The tree will ultimately have hundreds of items within it and I'm adding a search bar (simple string control).

 

I'm looking for someway to problematically hide all of branches that don't contain the search query but I can't find any methods or properties that can do this.

 

Any ideas?

Share this post


Link to post
Share on other sites

The only way I know of is to modify or rebuild the tree in response to the changing search string. I don't think you can hide individual nodes.

Share this post


Link to post
Share on other sites

As MJE said, I don't think you can hide branches without rebuilding the tree.

But you can close all the branches that don't contain the search query, and only open the branch that does, if that would be sufficient.
Use the "Open/Close" >> "All" method to close all branches, followed by the "Open/Close" >> "Ensure Visible" method to open only the branch
that contains a particular tag.
 

  • Like 1

Share this post


Link to post
Share on other sites

mgunning, you are spot on! The only problem that I am facing now is that I want to open the child branches of the matched search term as well.

 

For example, the complete tree is

  • John
    • Jacob
      • Jingleheimer
        • Schmidt
  • Jane
    • Doe

Searching "Jane" should return

  • John (collapsed)
  • Jane
    • Doe

Any ideas?

Share this post


Link to post
Share on other sites

Well, to find the child branches of "Jane", you can use the "Navigate Tree" method.

"Navigate Tree" >> "Get Child" will find the first child.

"Navigate Tree" >> "Get next item" will find the next child at the same level of the hierarchy. It will return an empty string if there are no more items at that level, so just keep searching until you come up with an empty string and you will have found all the branches under "Jane".

You can then use the "Open/Close" >> "Ensure Visible" method to open all these branches.

 

If you want to open the entire hierarchy underneath "Jane" right down to the very last twig, you will have to search through each branch to find the final value of each branch, and use "Open/Close" >> "Ensure Visible" to open all those values.

Share this post


Link to post
Share on other sites

For searching, you may wish to create a separate dataset from the tree control that better allows searching. This dataset would need to include the tag name of the entry in the tree. Navigating through a tree is not the fastest thing in the world.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By Axelwlt
      Hi,
      In a Mouse Down? on a tree, I need to know if the user clicked on a expand/contract symbol, because I need to discard clicking on items but I still need the expand/contract mechanism.
      I would need something similar to the InSymbol from the Point To Row Column method, but for the expand/contract symbol.
      How can I do that?
    • By willsan
      hi. I call VI use the invoke node ,the source code is below picture, if run the source code, the VIs can be normal called, but if run the generated EXE, the VIs can not  be called.
      the Chinese character "假" means false.
    • By brownx
      I have a CSV with data like:
      Name  Addr Number
      Paul     13      235
      Sarah   1        15
      I need the fastest possible way to get the Addr/Number pair which matches the searched name (exact match, occurs only once). The whole search will be called lots of times from a teststand - this is why I need to have it fast.
      The simplest is to load the csv into array once than do a loop with string compare (fastest in this case probably being the string subset). 
      Is there any faster way for achieving this without hardcoding the name,addr/number pairs into a switch/case?
    • By PLeVasseur
      Some background: I'm trying to use the name of the library my VI is executing in as part of a string which will be used in the name of a Rendezvous, to keep it distinct from other Rendezvous I will create.
       
      When attempting to use the VI Property Node to access the Library property on the CompactRIO, error code 1 is returned. Running the same code on my computer runs as expected and returns the Library. Accessing the VI Name using the Property Node appears to work no problem on the RT, though.
       
      Does anyone know what could be causing the problem? I tried searching the documentation, but didn't turn up anything. Is this error part of some general behavior wherein some VI properties are not accessible when a VI is running on a real-time target?
       
      Code is attached. Please see attached pictures:
       
      Project Explorer:

       
      Block Diagram:

       
      Front Panel - RT Results:

       
      Front Panel - Computer Results:

      Experiment with VI Property Node Error.zip
    • By Kurt Friday
      Hi All
       
      I'm playing around with visualising clusters as a tree structure. I've got some nice code working that I thought I would share.
       
      It's part of an abstract data viewer that I'm working on.
       
      Code is based on Open_G Variant and Open_G Config File tools
       
      ClusterViewer.zip
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.