How to search a tree control.

Hi all,
I just started learning Flash Builder not too long ago, quite a learning experience I have to say. I am a little lost and woul like some help from you guys.
I am trying to build a menu tree that will display and image and information about that image when the corresponding node is selected.
I also want to have the menu tree searchable, I looked at a few examples of tree controls to get some ideas but I keep hitting brickwalls left and right.
I started over few times trying to follow some of the examples. Right now, I only have the visual elements, please see the code below.
Thank you so much in advance.
Here's the code I have so far:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="960" minHeight="560" backgroundColor="#FFFFFF" width="960" height="560">
<fx:Declarations>
</fx:Declarations>
<mx:HDividedBox y="80" height="415" x="25">
     <s:Panel x="20" y="95" width="240" height="415">
          <s:TextInput x="10" y="-25" height="20" contentBackgroundAlpha="1.0" borderAlpha="1.0" textAlign="left" fontWeight="normal" text="Search" focusColor="#70B2EE" fontSize="10" color="#646464"/>
          <mx:Tree id="tree"
                    x="10" y="5" width="220" height="370" borderVisible="false" color="#787878">
          </mx:Tree>
          <s:Button x="160" y="-25" label="Find" fontWeight="bold" fontSize="10"/>
     </s:Panel>
     <s:Panel x="275" y="95" width="660" height="415">
          <mx:SWFLoader id="swfLoader"
                           scaleContent="true"
               x="0" y="0" width="660" height="190"/>
          <mx:Text width="639" id="treeSelectedData"
                     height="169" x="9" y="203"/>
     </s:Panel>
</mx:HDividedBox>
</mx:Application>

You should take a look at the help documentation about the tree component. They have an example code at the bottom that shows how to load in data to the tree and how to perform actions when a node in the tree is selected. Below is a link to the help documentation on the tree component.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Tree.html?f ilter_flex=4.5.1&filter_flashplayer=10.3&filter_air=2.6

Similar Messages

  • Please, I need help in this,How to make a tree control appear from right to left ??

    i working on Arabic project in which we use a tree control and i  want it to display its branches from right to left .
    i tried to rotate it but it doesn't work because the disclosure triangle still appear on the left .
    i ask if there is any thing to mirror the tree control ,and ask if this mirroing will work or not?

    You'll need to modify the layout logic of your renderer.
    Here's a simple example that extends the default tree renderer and overrides the updateDisplayList method(). It will probably need more work. Set textAlign="right" on your Tree control when you use this renderer. You'll also need to supply a disclosure icon that points in the opposite direction.
    package
        import mx.controls.treeClasses.TreeItemRenderer;
        import mx.controls.treeClasses.TreeListData;
        public class RightToLeftTreeItemRenderer extends TreeItemRenderer
            override protected function updateDisplayList(unscaledWidth:Number,
                                                      unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                var startx : Number = data ? TreeListData( listData ).indent : 0;
                startx = unscaledWidth - startx;
                if ( disclosureIcon )
                    disclosureIcon.x = startx - disclosureIcon.width;
                    startx = disclosureIcon.x;
                if ( icon )
                    icon.x = startx - icon.width;
                if ( label )
                    label.x = 0;

  • How to search array of control refs

    I have an event case that handles a number of controls of different types in the user interface. I have a global array that holds references to each of several ring controls; I'd like to test whether the control that triggered the event is one of the ring controls.
    I can use a while loop, and control the CtlRef for the event to each ref in my global array--that works fine. But it seems that the Search 1D Array operator would be a natural choice, cleaner and likely faster than a while loop. However, I get a type mismatch when I hook the array of ring refs and the incoming CtlRef to the search function. I tried casting to more specific type on the CtlRef--to a ring ref--but that didn't fix it. Any ideas?

    tst wrote:
    You should have gone the other way. When you have an event common to several types of controls, the CtlRef terminal will use the class common to all those controls, so you should cast the references to the more generic class. The cleaner solution, however, is to use the equal node to compare the array of references to the CtlRef terminal and then search the resulting array for T.
    Yes, I did consider that I should be going to more general, but it seemed that I couldn't do that to the array in one shot, so it would have bought me nothing over the sub-optimal solution that already worked. The conversion to the array with the compare node I hadn't considered though, and that's an excellent solution--thank you much :-)

  • How can I save the all the values of a tree control ?

    I have a problem, in run time, I adds new items on a tree control, but i don´t know how I can save the values of the child text of each item in a file.
    Thanks.

    I'm no expert on the tree control, but I made a small example to save all items to a textfile, including item tag, item string, and indent level. One drawback of this method is that it fully expands the tree regardless how the user left it. To go the other direction, you'd have to write a routine to go through the text file and programmatically build the tree.
    To master the tree control, I think you have to resort to creating a control reference for it and using the Invoke Node to do some operations. For another approach to traversing and operating on a tree, check out the "Traversing Tree Controls and Setting Custom Symbols" (search the NI Developer Zone site).
    Best of luck,
    John
    Attachments:
    Save Tree Structure to Textfile.vi ‏32 KB

  • How to get position of a ring in a tree control?

    Ok, this is probably a stupid question, but how does one get the position of a ring inside of a tree control?  I have a tree with two columns, with rings in the second column.  I can set the position using SetTreeCellRingValueFromIndex(), but how does one get the position after the user has modified the control?  I found the functions GetTreeCellRingIndexFromValue() and GetTreeCellRingValueFromIndex() but I haven't found a way to get either the Index or the Value of the ring (what I'm looking for is the index, but if I can obtain the value I can go from there).  Thanks in advance!
    Solved!
    Go to Solution.

    Hi,
    You can use GetTableCellVal function to get the value of the ring.
    There is not special "ring" function for that. Maybe that's what you were searching for
    From the value you can get to the index using the functions you are already aware of.
    Hope this helps,
    S. Eren BALCI
    www.aselsan.com.tr

  • How can I display and change built-in symbols of a tree control programmatically?

    I want to set the built-in symbols of a tree control during runtime.
    I only found an example to assign custom pictures but not how to select one of the 40 built-in symbol.
    Many Thanks 
    Solved!
    Go to Solution.

    The ActiveItem.SymbolIndex will allow you to select the symbol for the active item. You can use the ListBox Symbol Ring Constant (Dialog and User Interface palette) to select a symbol (or you can just enter the number directly if you know what it is).
    Message Edited by smercurio_fc on 07-10-2008 09:36 AM
    Attachments:
    Example_VI_BD6.png ‏2 KB

  • How to get all items under a parent item in a tree control

    Hello,
    I have 2 questions regarding a tree control:
    1) Is there any way to specify a parent item tag and get an array of ALL its sub item tags? For example, in the attached vi, specify the Parent#2 parent tag and get an array containing Item#P21 and Item#P22
    2) Is there a way to specify a range to the ActiveCell property. For example, all items from line#1 to line number#3
    Any ideas?
    Attachments:
    Tree example.vi ‏6 KB

    Mentos wrote:
    1) Is there any way to specify a parent item tag and get an array of ALL its sub item tags? For example, in the attached vi, specify the Parent#2 parent tag and get an array containing Item#P21 and Item#P22
     Did you try a search? There's no direct way of doing this. You have to navigate the tree and build up an array. You can find an example here: http://forums.ni.com/t5/LabVIEW/get-all-children-o​f-a-parent-in-tree/td-p/729548
    2) Is there a way to specify a range to the ActiveCell property. For example, all items from line#1 to line number#3
    No. (It's called ActiveCell, not ActiveCells) Presumably you are trying to perform an operation on multiple items. Unfortunately, you need to use a loop. You should defer panel updates if you're doing this a lot.

  • How to use the drop event of the tree control in LabVIEW 8.20?

    Hi,
                I am using the two tree controls in my application to provide a option for the user to drag and drop item from one tree to the other.  I have to validate the user selection. I tried to capture the user drop event  using the event structure. The problem I am facing is, I am not able to drop the item even though i have wired a constant true to the filter(Accepted?) in the event case. I have enable the property(Allow droping) in the right menu of the tree control also.
              While configuring an event case for (drop, drag entered and some thing like this) only I am getting the problem otherwise it is working fine.  
    What do i need to do to caprture the drop event ?
    Is there any way to avoid the item duplication while droping a new item in the tree control ?
    or how can i do this?
    Thanks,
    Pandiarajan R

    Hi Pandiarajan,
    I hope you are doing well today! There is a lengthy discussion on the Tree Control Drag & Drop feature at this forums post including contributions from the developer of the Drag & Drop feature:
    Tree Control Drag & Drop in LabVIEW 8
    By avoiding item duplication, do you mean that you don't want the same item to be in the old tree control or do you not want more than one item in the new tree control?
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • Tree control - How to get the full path of selected Item in tree control

    I am Flex newbie. When the user clicks the particular item in
    the tree control I just wanted to get it name along with it's full
    parent.
    Here is my XML
    var dirXML:XML=<root basename="/home/tcegrid">
    <Directories>
    <Dir Name=".autosave" />
    <Dir Name=".emacs.d" />
    <Dir Name="AnsysDistributed">
    <Dir Name="opt"/>
    <Dir Name="root" />
    </Dir>
    <Dir Name="postgres"/>
    <Dir Name="FineTurbo"/>
    <Directories>
    </root>
    The above XML is data provider for Tree control. When the
    user clicks the Dir Name called opt. I wanted it absolute path in
    XML. say Directories.Dir.Dir.@Name is opt
    Can any one tell me how to get this?

    "Thamizhannal" <[email protected]> wrote in
    message
    news:gam9q8$4es$[email protected]..
    >I am Flex newbie. When the user clicks the particular
    item in the tree
    >control
    > I just wanted to get it name along with it's full
    parent.
    > Here is my XML
    > var dirXML:XML=<root basename="/home/tcegrid">
    > <Directories>
    > <Dir Name=".autosave" />
    > <Dir Name=".emacs.d" />
    > <Dir Name="AnsysDistributed">
    > <Dir Name="opt"/>
    > <Dir Name="root" />
    > </Dir>
    > <Dir Name="postgres"/>
    > <Dir Name="FineTurbo"/>
    > <Directories>
    > </root>
    >
    > The above XML is data provider for Tree control. When
    the user clicks the
    > Dir
    > Name called opt. I wanted it absolute path in XML. say
    > Directories.Dir.Dir.@Name is opt
    > Can any one tell me how to get this?
    loop until the parent() property of the XML node is empty.
    HTH;
    Amy

  • How to render image in tree control without embed it

    Hello frndz i am working on tree control and want to show imagein its node through xml list collection.i have searched a lot for this but in every example with tree control images are embeded.i dont want to hardcode the image.Need to make the image comes from database(Xml).so is there any live or demo example for tree control.
    Thanks in Advance
       Vineet osho

    if you decompile the imaging.ear file, there is a web.xml file which you can add the following parameter:
    <context-param>
    <param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
    <param-value>never</param-value>
    </context-param>
    or take a look at      Receiving "Warning: Unable to load content in a frame. Frame content will load at the top level." When Trying to Use the <af:inlineFrame> Component [ID 1266770.1] on Oracle Support.
    Make sure you take a copy of the imaging app before you make changes. You can then upload back through the weblogic console.
    Sudi

  • How to use Tree control like a Tree in SAP HANA Live Browser?

    Hello SDN!
    I need a Tree control such as following:
    As I understand, there is no such standard control in SAPUI5 control library. Is it possible to use this control? If yes, how I can embed it in my app?
    Regards,
    Lev

    Hi Sandip!
    Thanks for your tip. I've applied this example to my app. Tree is working now, but this is a little problem - on each expand/collapse and click on treeItem the onAfterRendering() method called. It means that the complete rerender of tree executed which looks not good. How I can avoid this?
    Lev

  • How can I search the tree with a given string?

    How can I search the tree with a given string?
    I don't find any function like "search(...)".
    I want to find the tree nodes which include the given string.
    Thanks.

    Try it with .com instead of .ca - fixes it for me (corporate firewall blocks .ca here)
    http://spendolini.blogspot.com/2013/09/working-with-apex-tree.html
    Anyway - it links to an article of mine which describes interacting with the tree: Tom's Blog: Working with the tree in Apex. There is also a demo application on apex.oracle.com: http://apex.oracle.com/pls/apex/f?p=54687:38

  • How to open child node in Tree control?

    Hi All,
    I am using arrayCollection in my tree control.
    I want to open one child node based on name of that node.
    How to open that chid node?
    I tried tree.OpenItems and ExpandItem methods. IT is not working. Any idea how to do it?

    write this statement
    TreeObject.expandItem("the branch",true)
    But make sure you dont call this statement right after you set the dataProvider for the tree object. Instead wait for a second or two and then call this statement. This delay is allow the tree object ot call it validate functions.
    Let me know if it helps

  • How to Flex tree control using folder click event  to pass coldfusion to get data from dynamiclly ?

    Hi friends.........
                Iam using flex tree control data coming from coldfusion file to display grid. As i click the tree folder to change the data from dynamic from grid.
    How to pass the folder id from coldfusion file.. Is it possible ?.. Means give any example please....
    Any One Help Me......
    With Regards.,
    Lingu.......

    When you set the dataProvider for your tree control, you actually pass an array or arraycollection or whatever to that property. The array contains objects coming from your server, right? Each object should contain a property with the folder id, something like:
    var arr:Array = [{id: 1, folderID: 34, name: "..."}, {id: 2, folderID: 4, name: "..."}, ...];
    Now, when you click an item in your tree or your dataGrid, you can access the folder id by:
    myTree.selectedItem.folderID
    Hope this helps
    Dany

  • How to get access to Row Data (Child Text) in a Tree Control Pragmatically?

    In LabVIEW 2010, I have entered Row Data into a Tree Control pragmatically using the Add Item method and providing the Child Text array and the Child Tag for the Row. When a Row in the Tree Control is selected, I can get the Row Tag in the Value Property of the Tree. But how do I access the Child Text array data when the Row is selected? I can't seem to find a Tree Control Property or Method that will return that data back again.
    What I am trying to do is: once a Row in a Tree is selected and a button is pushed, if the Row Tag is valid, I want to transfer all of the Row data into another similarly formatted Tree. To do that I need the Row Data for the Tree and Row that was selected. I can not find a way to get access to this Row Data after it has been entered into the Tree.
    Can anyone tell me how to pragmatically access the Child Text or Row Data in a Tree Control from a selected Row in the Tree? I have the Tag for the Row, but how do I access the data?
    Thanks for your assistance.
    Solved!
    Go to Solution.

    As mentioned in the posting here, you can use the Active Item:Tag property to set the item to which subsequent property changes apply. This includes pulling the Active Celltring values out in a for loop as you increment the Active Cell:Active Column Number to get the row's Child Text data programmatically as I was originally wanting to do.
    Note that wiring a 0 to the ActiveColNum property and reading the String value will return the tree item's visible name (in column 0), but not the unique item Tag (which is somewhat intangible after its creation). Therefore, I save the unique item tag when I add the item to the tree control (the output of the Add Item invoke node) and store it as a separate column of the Child Text array and place it out of sight in the tree control so I have access to it later. It might be useful, it might not.
    I find the tree control totally non-intuitive and not well explained anywhere, but that's how a lot of LabVIEW coding is I guess. Play with it long enough and you become an expert. I had to learn the hard way, but I hope this helps someone else.
    -Richard
    "Computers are useless. They can only give you answers." - Pablo Picasso

Maybe you are looking for