Jump to content
szewczak

Window Drag and Drop (bodge)

Recommended Posts

This VI demonstrates how you can bodge a VI to accept drag and drops of files and folders just like a path control (without losing any mouse click/move event functionality).

Path controls have an API for dragging and dropping Files/folders from the OS, or correctly formatted strings from Excel. While an acceptable drag-and-drop operation is underway the path control adds a dotted box to the control (I'm calling this a target box). However this behavior is not available for other objects such as panes or other controls. So Bodging time.

DragandDropBodge.vi (attached to the original lavag.org post) has a transparent Path control (set to 'Scale object with pane') that in all the use cases where a drag and drop is possible is set to Visible=True, and in all the use cases where the user would click on an object within the pane is set to Visible=False. I am using a shift register and the Timeout case to Visible=False the Path control, but for a more complex VI or when you have an existing need for the Timeout Case, you can manage this with a user event.

Other implementations:

This could be used to bodge drag-and-drop for a xy graph or other indicator instead of the pane at large. Or by capturing the cursor position at the moment of 'value update' for the path control a drag and drop could update a specific line in a tree/table/array.

 

Hope this helps when you are searching with the same keywords I was and found no solutions!

NSz

DragandDropBodge.vi

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.


×
×
  • Create New...

Important Information

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