Shaun Hayward Posted January 12, 2010 Report Share Posted January 12, 2010 I have a tree control that represents a bunch of data from a database. A user must be able to logically re-arrange that data using drag and drop. I therefore want to catch the drag / drop events to determine: 1. During the drag, is the current potential drop location valid? 2. At the end of the drag, was the database update successful? (if not, I want to discard the drag/drop action). I seem to be running into a big headache with the necessary tree control filter events in that: A. Adding a drag over event seems to be discardign the drag/drop action B. The drop filter event seems to be causing nodes to vanish. I have made a slimmed down VI (ie with everything but the tree control removed), and made two tree controls (one with the drag over event, and one without) to demonstrate the problem. I would really appreciate any ideas as to what is going wrong! (LV 2009) Thanks! Shaun (I have also put in a support request to NI, so if they come up with a solution, I'll be sure to post back!) Debug - Drag and Drop Test.vi Quote Link to comment
Shaun Hayward Posted January 13, 2010 Author Report Share Posted January 13, 2010 This has been raised to R&D with a CAR of 202287. (If any of you have an idea for a work-around in the mean time I would greatly appreciate it! Quote Link to comment
Shaun Hayward Posted January 14, 2010 Author Report Share Posted January 14, 2010 OK it looks like I've found a hack work around to the LV 2009 tree control drag/drop events: copy and paste a tree control and it's associated event structure (including "Drag?" and "Drop?" filter events from an application written in an earlier version of LabVIEW -> these *seem* to work, but as it's dinner time, I'll have to wait until tomorrow to give it some proper testing. PS> If any one else goes down this route, remember that if those "Drag?" and "Drop?" filter events are deleted they cannot be recreated in LV 2009! Quote Link to comment
Ton Plomp Posted January 14, 2010 Report Share Posted January 14, 2010 There are some specifics about LabVIEW event and drag/drop. I think that if one registers for the 'Drag source update' event, LabVIEW assumes that you will handle the drag and drop event. Here is some more info. Ton 1 Quote Link to comment
Shaun Hayward Posted January 14, 2010 Author Report Share Posted January 14, 2010 Thanks Ton - It seems that you are right, if I put in all of the drag and drop code manually with all of the events I might be able to get it to work with the non-legacy event structures.... However, I dont suppose you (or anyone else for that matter) know(s) if there is a way to get the visual feedback (or even something similar to) that one gets with the built-in drag/drop handling? Quote Link to comment
Ton Plomp Posted January 14, 2010 Report Share Posted January 14, 2010 I have the following construct: A 'Drop' event on a tree control. In this event I have set 'accepted' to 'False', this means that LabVIEW assumes that the drop was unsuccesfull. No problem. I handle the drop of data inside that event myself. A 'drag ended' event on the same tree control. This is triggered when the drag has ended (whether the drag and drop was succesfull or not). I use this to rearrange my data structure. Here is the drop event code: PS the equal tests the 'parent' output of the following subVI. And here is the code of the subvi: Ton 2 Quote Link to comment
Shaun Hayward Posted January 14, 2010 Author Report Share Posted January 14, 2010 Wow - thanks Tom! There's definately a lot there for me to chew over (and come up with some ideas)! Unfortunately, due to time / $$ constraints and the fact that I'm creating a new app that is going to be an upgrade to a very old and bloated LV 7 (if not earlier) app, I think for now I am going to have to stick with the depreciated events as they are so much easier to get the right look and feel. Still... next time I get a spare movement, I'm going to definitely have to look into this some more! Quote Link to comment
Mr Mike Posted July 21, 2010 Report Share Posted July 21, 2010 These are two separate issues: drag over not working, and drop deleting tree items. You can use the attached VI to copy a tree and event structure out of. What's important is that you have the old event ("Drop?", not "Drop"). You can replace the tree with a system tree as long as you right click on the tree and select Replace. Don't delete the tree. TreeWithDropEvent.vi Quote Link to comment
durnek60 Posted December 3, 2010 Report Share Posted December 3, 2010 These are two separate issues: drag over not working, and drop deleting tree items. You can use the attached VI to copy a tree and event structure out of. What's important is that you have the old event ("Drop?", not "Drop"). You can replace the tree with a system tree as long as you right click on the tree and select Replace. Don't delete the tree. Hi! Is there any way to Get these new Items, without replacing my old event structure with yours? My App is big... Quote Link to comment
Mr Mike Posted February 18, 2011 Report Share Posted February 18, 2011 Hi! Is there any way to Get these new Items, without replacing my old event structure with yours? My App is big... No, there's no way to do that. Since my last post, I found this thread, which documents that this is intended behavior and if we want to use the drag/drop events, we need to do the move ourselves Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.