Jump to content

Edit Tree Items.Move Item functionality implementation is tricky


sdserlin

Recommended Posts

The help page on the Edit Tree Items: Move Item Method states for "New Position":

 

"Sets where to place the item in relation to the item whose tag you wire to New Parent. Wire a value of 0 (default) to place the item above the first child item, wire a value of 1 to place the item above the second child item, and so on. Wire a value of –1 to place the item under the last child item. If the value you wire to this input is greater than the number of child items under the parent item, the method places the item under the last child item."

 

If I do not know in advance what the new position will be until the user chooses an item on the tree, what algorithm can take the selection row number and then adjust this "new position" value to move up by one row or down by one row? I can't just take the ActiveItemRowNumber and subtract one or add one to get the previous item-row-number or the next item-row-number and then take that value into the "Edit Tree Items.Move item" invoke node because the .Move item node does not work that way. Why it doesn't is beyond me. Nonetheless, I need a workaround to this issue. Any suggestions?

 

post-38459-0-74329600-1392394511_thumb.p

post-38459-0-05695800-1392393577.png

Link to comment

Please do not double post.  If you are unhappy with your first post you are welcome to edit it, or us the Report to Moderator button to get posts edited or deleted.

 

On topic could you post some code of what you have.  It's still a little difficult knowing what you want.  You are saying what method can you use to move an item that the user selects up or down?



Okay so I think I found what you were talking about, and I think I have a solution.  I don't know if there is a better way of using it, but what it will do is find the parent of the current tag, then find all children under that parent.  Then find within that list of children, where does our current tag exist.  Then move that position.  Alternatively you could allow the user to click and drag to move items around, but I admit that getting this to work the way you want can be a pain.

Tree Move Item Up.vi

  • Like 1
Link to comment

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.

×
×
  • Create New...

Important Information

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