06-05-2025 08:28 AM
Hello,
I am struggling with the events on the subpanel.
My main purpose is to drop a string on the subpanel and automatically load a VI with the name specified by the string, in the subpanel.
1. is it possible to catch the subpanel events directly in an event structure? Because at the moment i only see the solution to register event callbacks.
2. If i drag a cell from a list box, or from a tree, and drop it on the subpanel, how can i see the text that was in the cell?
I was thinking that i can create a queue and feed it as User Parameter. Before dragging the cell, i put the value in the queue. When the drop event happens, i read the value from the queue in the callback.
Any ideas?
Thank you and best regards,
Marian
Solved! Go to Solution.
06-05-2025 11:37 AM
Seems like an odd way to do things. Why not just have the code load the SubPanel when you select (or possibly double-click) an item from a list box or tree?
06-06-2025 01:50 AM - edited 06-06-2025 01:51 AM
Hi Paul,
Thanks a lot for the suggestion. The thing is that i want to have more sub panels, but only one list of VI names. And i kind of like the idea to drag and drop. It is a bit more interactive. 🙂
Best regards,
Marian
06-06-2025 03:09 AM
This reminds of trying to make your app open a file by dragging it onto the FP from Windows explorer. Here is a thread about that: https://forums.ni.com/t5/LabVIEW/Drag-amp-drop-from-explorer-into-my-application/m-p/1766976#M614689
Maybe you can create transparent string controls over the subpanels and make them "visible" when a drag starts and invisible when drag ends. You would need to capture and handle the drop event for each string control. I haven't thought about this in more detail, might be worth a shot.
06-07-2025 12:05 PM
This kind of works; but you have to move the mouse slowly as you drag into the SubPanel.
06-10-2025 02:51 AM
Hello Paul,
This looks amazing. Thanks a lot for the solution.
One more question arises now: After i drag a text and a VI is loaded in the subpanel, how should i handle if i want to drag another one, to load another VI? As far as i can see, the event doesn´t work anymore after you have a vi loaded.
Thank you again and best regards,
Marian
06-10-2025 09:47 AM
@Marian_G wrote:
Hello Paul,
This looks amazing. Thanks a lot for the solution.
One more question arises now: After i drag a text and a VI is loaded in the subpanel, how should i handle if i want to drag another one, to load another VI? As far as i can see, the event doesn´t work anymore after you have a vi loaded.
Thank you again and best regards,
Marian
Initially, when the SubPanel is empty, the entire area of the SubPanel receives events (e.g. "Drag Over"). After the first SubVI is loaded, "Drag Over" events in the middle of the SubPanel go to the loaded VI, not to the SubPanel. However the SubPanel still receives those events on its border; which is very narrow. However if you drag slowly over the border, it will work as you want.
06-10-2025 09:56 AM
you are totally right, you have to go slow and it works.
Thanks a lot for your support!
Best regards,
Marian
06-10-2025 12:28 PM
Here's an updated version.
I made a string indicator that's a bit larger than the SubPanel, placed it behind the SubPanel, and colored it transparent.
Then I added to the code so the sting indicator also traps the "Drag Over" event.
Now there's a larger region around the SubPanel for capturing the "Drag Over" events; so you don't have to move as slowly.
06-16-2025 03:45 AM
This new version works really good, thanks for your support.