Dragging items in LV7 tree control

If I have a parent item and then a group of child items and I'm dragging them within the parent group to rearrange the order, the cursor flashes back and forth back from an insertion line between two child items, to highlighting the parent item. If the parent item is out of sight because the user has scrolled down the list, the insertion line simply disappears and then should the user 'drop' the item they were dragging, it is placed out of sight at the very top of the list. Is there a way to disable this intermittent highlighting of the parent item?
It seems if you wanted to drag an item to the top of the list and highlight the parent, you would do just that and would never really want to try and perform that function by dragging o
ne item directly onto another (which, when doing a drag/drop, seems like the item would drop above or below the item the mouse was directly on).

I'm on Win2k. To reproduce the problem (the manual way)...
Create a new table
Click in the top left and type new items:
- Parent 1
- Child 1
- Child 2
- Parent 2
- Child 3
- Child 4
Drag child 1 and 2 into parent 1 so they become sub-items
Drag child 3 and 4 into parent 2 so they become sub-items
Table
- Parent 1
- Child 1
- Child 2
- Parent 2
- Child 3
- Child 4
For each child item right click and select 'Child-Only Item'
On the code page create a property node to set the attributes below:
T -> Allow Dragging
F -> Allow Dragging of Parent Items
T -> Allow Dragging Between Items
Run that once and then go back to the front panel and try dragging stuff on the tree--it will exhibit the behavior described earlier, as well as allowing you to rearrange items within a group.
I will also highlight another problem I had for my particular application... perhaps if others have it this will save some time. It took me quite a bit of banging around to find a solution.
Drag Child 3 and Child 4 into Parent 1--Parent 2 is left as an empty group.
Table
- Parent 1
- Child 1
- Child 2
- Child 3
- Child 4
- Parent 2
Now try dragging a child below parent two but not on top of it--ie, Parent 2 is not shaded but a line is visible below it indicating that is where the item will be placed. This creates what would appear to be a parent item (only it isn't).
Table
- Parent 1
- Child 1
- Child 2
- Child 3
- Parent 2
- Child 4
This surprised me, mostly because it took a while to figure out how to disable it. Filtering drop events with a little bit of logic will let you disable this behavior though.
Use the TargetTag inside the event handler with the Navigate Tree methods. If there is no parent and no child of the item you're about to drop on, and you're actually dropping BelowTarget instead of on it, then the item would normally be changed to appear as a parent on the tree.
If [Navigate Tree:Get Parent of TargetTag = Null?] AND [Navigate Tree:Get Child of TargetTag = Null?] AND [BelowTarget = True?], discard the event.
Happy putzing around. I don't think there is a way to disable the weird behavior where it flips back and forth between the parent item and the items you're in between. If you drag across several items it just flickers like crazy but at least it still works and will eventually do what you want it to... just takes some getting used to.

Similar Messages

  • How to highlight all child items in a tree control?

    I have a tree control and a boolean button. I want to use the button to select all (highlight) the child items in the tree control. I've seen CVI functions where you can set the active items, but such a function/method does not appear in LabVIEW.
    Any clues?

    Hi settles,
    Once you have all the children, you just need to set the value of the tree control to be an array of all the child tags.  Here's a screenshot of a VI that does this:
    First I get all the tags, then I get the parent of each tag.  If the parent is a non-empty string, I add it to an array.  Then I write that array value to a local variable of the tree control.  Let me know if you have any questions on this method.  I believe the "All Tags" property I'm using was added in LabVIEW 8.0.
    -D
    Message Edited by Darren on 08-20-2008 10:58 AM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    select_all_children_in_tree.PNG ‏34 KB

  • How to handle events occuring on different items in a tree control

    I am developing a small application in which I need to display different panels when user clicks on a tree control item....how to make it display a panel inside a parent panel when a user clicks an item in a tree control....any help would be greatly appreciated. thank you
    If you are young work to Learn, not to earn.

    The tree control can handle several events that you can rely on to handle user interaction. I suggest you take a llok at treeevent.prj example that comes with CVI. In your situation, one possible event to handle is EVENT_SELECTION_CHANGE, that marks the operation the user does when clicking on a new tree item.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How can I drag and drop an item from one Tree control to another in LabVIEW 7.1?

    You can use the mouse up and down event on the two tree controls but the problem is making the correct selection in the second tree control. I want to be able to switch over to the selection bar of the second tree control so that I can place my item in the correct position. I know all possible workarounds with double-clicks and so on... but I really want a windows drag and drop.
    This is what I have for the moment. Please check the library below. I need to activate the selection bar of the second tree control somehow to get the position in the control. The VI below is written in LV 7.1
    Attachments:
    Drag&Drop.llb ‏65 KB

    Hi Jones,
    As far as I know this feature is currently not supported by the Tree control. A workaround, would be to use the vertical position of the mouse in the button up event to determine what line you�re dropping the item.
    If you would like the Tree control to include the drag and drop feature, please submit this as a Product Suggestion under the feedback at www.ni.com/contact.
    Good luck!
    Best regards,
    Philip C.
    Applications Engineer
    National Instruments
    www.ni.com/ask
    - Philip Courtois, Thinkbot Solutions

  • 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.

  • LV7 Tree control Modify Left Cell String

    Is it possible to modify the "Left Cell String" of a tree node - I can't find the appropriate method or property to do this.
    Cheers,
    Wayne

    Pleeeeaaaasssseee don't use stacked sequence structures.  Use flat sequence structures if you need to.  And even then in your code you can eliminate most of them by using property nodes and error wires appropriately..
    Look at https://decibel.ni.com/content/docs/DOC-4519.  Use Defer Panel updates to speed up the execution when updating multiple tree control properties.
    See attached modified VI.
    Attachments:
    TreeExampleMOD.vi ‏27 KB

  • How to display a seperate right click menu for each item of a tree control?

    Hi I want to display a specific right click menu when a particular tree item is selected. I know how to create a menu and how to display it. I am using the function GetLabelFromIndex() to get the active tree item and then compare the label and based on the result display a manu for that item. Now my problem is that when I use the above function in the EVENT_RIGHT_CLICK it gives me the error "the Index passed is out of range" while using the same function with the same arguments in EVENT_SELECTION_CHANGE it gives no error...below is the part of my code
    case EVENT_RIGHT_CLICK:
    GetLabelFromIndex(panelHandle, PANEL_TREE, eventData2, label1);
    //The function gives the stated error here
    if(eventData1)//after it I compare the result and display the menu
    case EVENT_SELECTION_CHANGE:
    GetLabelFromIndex (panelHandle, PANEL_TREE, eventData2, label1);
    //The function works fine here
    if (eventData1)
     If any one have any idea whats going on or alternate way of doing this Please share knowledge...Thanks
    If you are young work to Learn, not to earn.

    Hi,
    one possible approach of solving this problem is looking closer at the error message: The error "the Index passed is out of range" tells you that something is wrong with the index, either it is too small or too large So why don't you set a breakpoint and check the index value, it might be useful information...
    The other hint is to check the meaning of eventdata2 (using the help): It is different for different events! For the event_right_click it gives the horizontal mouse position, not the index as event_selection_change does...

  • 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

  • Tree control: How to disable the selection of a child item

    Hello everyone,
    Im having trouble with disabling the selection of a child item in a tree control. I dont know if its possible but havent found any answers on this forum regarding this issue.
    Example:
    Parent tag 1
        child item 1
        child item 2
    Parent tag 2
        child item a
        child item b
    What i would like to do is being able to select the parent tags but not the child items, because i use the name of the selected item in my program to determine which actions are allowed and those that are not. To avoid this problem i look at the first 4 letters of the name and this way i can determine if it is a parent tag or child item and take appropriate action. Im able to do this because the parent tags have fixed names. But even though nothing happens in software if i select a child item it still lights up, so for the user of the program it looks as if the child items is selected but the program doesnt do anything(because i made it that way). Thats why i want to be able to disable the selection of the child item or at least make the selection colour of the child item transparant so it doesnt look like it is selected.
    Can anyone help me with this problem, if there are parts of my question you dont understand, just ask.
    greetz
    Ynse.

    Muks,
    your last image disables the whole tree.
    To programmatically disables an item use ActiveItem.Disabled? property.
    Unfortunately this only has two states, Enabled and disabled (thus grayed).
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • 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

  • Manual Drag and Drop from Tree to Tree with XML dataProvider

    Been struggling with Drag-n-Drop between Tree controls. As far as I can tell, it doesn't work very well.
    I have boiled it down to a minimal project below and would be ever so grateful if someone can tell me what I am doing wrong.
    The complete MXML application file is below. Flex 3.5.
    Two trees side-by-side. One has XML that I want to drag over to the drop tree.
    On the DragOver() event, I select the node which is given to me by the calculateDropIndex() function.
    After startup; first open the L1 branch on the left and drag L11 over and drop it on the right Tree.
    Looks good, root node is selected/highlighted and dropFeedback is correct and dropping the node drops it as a child of "Start Here".
    Open the Start Here root node to see it.
    Now proceded to #1 below.
    Here are the problems:
    1) Drag "L12" from the left tree over to the middle of the right tree (below "L11" just dropped). "L11" will not be selected. The Selected node (with dropIndex=4) will be the entire new nested XML "<L><L11/></L>"; and therefore only "Start Here" node will be highlighted. Drop "L12" anyway. So, it is acting like selectedIndex = <anynumber> will only select the root node. How do I get the new L11 to show as a drop target?
    2) Now drag "L21" from the left tree onto the right tree; again starting below all nodes on the right tree. Selected node will not change until you drag it above #2 out of 3. Then, you can drag it anywhere, and correctly highlight/select any node as the target, and get that node in code. This is a problem. Go ahead and drop it anywhere. Now if you drag, for example, L22 from the left it will correctly highlight/select any node without having to first drag above #2 in the list.
    3) Now, grab and drag L11 a second time and drop it at the bottom on the right. Drag L23 over. No matter which L11 you hover over, it highlights the one at the bottom. How can this be right?
    Those are the bugs I would like to figure out. If I am doing it wrong, I sure would like to know what I am doing wrong. The code below is distilled down to one simple mxml application module.
    Thanks,
    Jeff
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" minWidth="955" minHeight="600">
    <mx:Script>
    <![CDATA[
    import mx.collections.XMLListCollection; 
    import mx.core.IUIComponent; 
    import mx.events.DragEvent; 
    import mx.managers.DragManager; 
    Bindable] 
    private var dragXML:XML = 
    <Tree label="root"><L1 label="L1">
    <L11 label="L11"/>
    <L12 label="L12"/>
    </L1>
    <L2 label="L2">
    <L21 label="L21"/>
    <L22 label="L22"/>
    <L23 label="L23"/>
    </L2>
    </Tree> ; 
    Bindable] 
    private var dragXMLListCollection:XMLListCollection = new XMLListCollection(dragXML.*); 
    Bindable] 
    private var dropXML:XML = 
    <Tree label="root"><L label="Start Here"/>
    </Tree> ; 
    Bindable] 
    private var dropXMLListCollection:XMLListCollection = new XMLListCollection(dropXML.*); 
    // ************* Drag Drop Events ********************
    private function dragEnter(evt:DragEvent):void
    if (evt.dragSource.hasFormat("treeItems")) DragManager.acceptDragDrop(IUIComponent(evt.target));}
    private function dragOver(evt:DragEvent):void
    // Calculate dropindex and set selected item
    var dropIndex:int = dropTree.calculateDropIndex(evt);dropTree.selectedIndex = dropIndex;
    // setting the selected item based on calculateDropIndex()
    var selNode:XML = dropTree.selectedItem as XML; // Getting XML for selected node in Tree
    var selNodeName:String = (selNode != null ? selNode.localName() : ""); 
    // Get dragged XML
    var dragNode:XML = XML(evt.dragSource.dataForFormat("treeItems")[0]); 
    var dragNodeName:String = dragNode.localName(); 
    trace(evt, "\n", dropIndex, "\n", (selNode ? selNode.toXMLString() : "null"), "\n", dragNode.toXMLString()); 
    // you cannot drop a shorter name on a longer name
    if ((dragNodeName.length >= selNodeName.length) && (selNode != null)) DragManager.showFeedback(DragManager.COPY); 
    else DragManager.showFeedback(DragManager.NONE);}
    private function dragDrop(evt:DragEvent):void
    // get selected node in drop tree
    var selNode:XML = dropTree.selectedItem as XML; //selected in dragOver() event
    // Get dragged XML
    var dragNode:XML = XML(evt.dragSource.dataForFormat("treeItems")[0]); 
    // Drop logic
    // Compare dragNode.localName().length to dropNode.localName().length
    // if drag longer; drop as child
    // if drag is equal; drop as sibling
    // Drag can never be shorter in this example.
    var isChild:Boolean = String(dragNode.localName()).length > String(selNode.localName()).length; 
    if (isChild){
    selNode.insertChildAfter(
    null, dragNode);}
    else
    selNode.parent().insertChildAfter(selNode, dragNode);
    ]]>
    </mx:Script>
    <mx:Tree id="dragTree" width="30%" showRoot="true" height="100%" labelField="@label"dataProvider="
    {dragXMLListCollection}"dragEnabled="
    true" dragMoveEnabled="false" dropEnabled="false" />
    <mx:Tree id="dropTree" width="30%" showRoot="true" height="100%" labelField="@label"dataProvider="
    {dropXMLListCollection}"dragEnter="dragEnter(event);" dragDrop="dragDrop(event);" dragOver="dragOver(event);"
    />
    </mx:Application>

    I just found out that by setting the dataProvider for each tree to the XML variable instead of the XMLListCollection variable, problems #1 and #2 went away!
    But the documentation says to use an XMLListCollection if you will be dynamically changing the tree contents.
    And, I just found out that #1 returns if I specify showRoot="false". But with it set to "true" that problem goes away. Is there some sort of minimum XML required to make drag-n-drop work on these Tree controls?
    Hmmmm. It appears that (for #3) the calculateDropIndex() will always return the last matching XML node - by name - in the tree.

  • 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

  • Tree Control Property Node for Accessing "Child Text" String Array

    When adding items to a tree control using the EditTreeItems invoke nodes, the inputs include "Child Tag", "Item Indent", "Child Only?", "Glyph Index", "Child Text", and "Left Cell String" as can be seen in this screenshot.
    There are property nodes for the tree control for accessing each of these elements, except for the "Child Text", which is an array of strings. It is possible to access this data as outlined in this forum post, but this method is somewhat involved and round about. 
    I suggest that a property for the Tree class be created to access the Child Text array directly.

     The work around only works if you do not have an empty string element some where in the middle.
    At lest could the "Active Celltring Property" read return an error when you have gone beyond the end of the array.

  • 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

  • Save Labview tree Control to file and Load from file

    I want to save all of the information from my Labview (8.2) tree control to a file and be able to read it back from a file and re-populate the tree control.  I am using different symbols as well as multiple columns and level of children in my control.  Does anyone have any suggestions on how to do this?
    Thanks
    Steve M.
    Attachments:
    tree pic.jpg ‏60 KB

    Hi Steve,
    I found a DF that talks about saving the tree to a spreadsheet file and have included it in this message.  To get items from the tree control, you have to use open up the tree and remove all of the items off of that tree, while still preserving the heirarchy of the tree.  The indent level property node will preserve the heirarchy of the tree and from there you can get the item tag and cell string. 
    To transfer the file to a tree, you will then need to read the file and insert items into the tree corresponding to the heirarchy.  I have also found a tutorial on how to traverse tree controls.
    I hope this helps.
    Regards,
    Nadim
    Applications Engineering
    National Instruments

Maybe you are looking for

  • Regarding Call Transction 'FBL3N'

    Dear Friends,                        i am calling  Transaction FBL3N from an ALV Report and I am able to do the same, but I am unable to call it for the specified date in selection-screen. And I want to display option All Items to be activated.      

  • Smasr form isuue(Tds form triggering based on year)

    Hi Friends, I am working on tdsform with codintion IF ZPDATE-LOW >= '20100401'. when we given date as out put Posting Dates                   01.04.2010         to    29.12.2010 Document Type                                      to Bank Challan Numbe

  • $$PORTLET_ID$$ problem using external JS file

    Hi mates, I have the following problem .. I have JS functions in an external file and I'm trying to use the following adaptive tag in a JSP. <pre> <pt:namespace      pt:token="$$PORTLET_ID$$" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/> </pr

  • Whats the best way to do a re-install?

    Hi I upgraded to Leopard the day it was released and I have had nothing but problems so I am wanting to do a fresh install. My question is, what is the best way to go about this whilst trying to make it as painless as possible... I am mostly concerne

  • Error while to trying to retrieve text

    Hi, I created a web site using pl/sql, with the Apache Web server and the mod_plsql, but sometimes, when I browse on the pages , I have this error: Error while to trying to retrieve text for error ORA-03113 I also have problems with words like "h", "