LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subpanel Drop event

Solved!
Go to solution

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

0 Kudos
Message 1 of 10
(509 Views)

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?

0 Kudos
Message 2 of 10
(482 Views)

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

0 Kudos
Message 3 of 10
(437 Views)

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.

0 Kudos
Message 4 of 10
(426 Views)
Solution
Accepted by Marian_G

This kind of works; but you have to move the mouse slowly as you drag into the SubPanel.

Download All
Message 5 of 10
(398 Views)

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

0 Kudos
Message 6 of 10
(339 Views)

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

0 Kudos
Message 7 of 10
(298 Views)

you are totally right, you have to go slow and it works.

Thanks a lot for your support!

Best regards,

Marian

0 Kudos
Message 8 of 10
(294 Views)
Solution
Accepted by Marian_G

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.

Message 9 of 10
(272 Views)

This new version works really good, thanks for your support.

0 Kudos
Message 10 of 10
(90 Views)