LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sub panel run time menu event

Solved!
Go to solution

Hi,

 

I feel as though I'm missing something obvous, but...

I create a runtime menu for the subpanel (the user can access it by right clicking hte subpanel name, for example, if a subvi is loaded in the subpanel). I go to the event loop so I can program the action of the runtime menu and... I can't find any event that looks like subpanel:shortcut menu activation. Where do I program this?

 

Attached is the screenshot of the new event dialog. It has the VI, the pane, and the controls *not including* the subpanels (I have four, see front panel image). Any ideas?

 

Thanks,

Danielle

 

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
Download All
0 Kudos
Message 1 of 8
(3,543 Views)

The subpanel control is a special control in that it doesn't have a terminal on the BD. My guess is that the function used to generate the list of controls in the events dialog takes only those controls and this is simply an oversight.

 

What you can do is register for the event dynamically - create a reference to the SP and wire it into a register for events node, then select the event in that list. I don't know if the saved shortcut menu works, so if it doesn't, you will also need to register the menu activation event and use that to populate the menu.


___________________
Try to take over the world!
Message 2 of 8
(3,520 Views)
Solution
Accepted by topic author dsavir

This is correct, there's no events for subpanel because it's a special type of controls. Most of the time, the events taking place on the subpanels are actually the events that should be handled by the VI inserted in the subpanel.

 

Registering dynamically is an option, but as of now (2013 SP1), there is a CAR opened about LV crashing on the Menu Selection(User) event execution (which is needed after Menu Activation?). Using 2012 and earlier also results on a crash on any filter event...

You'll probably need to find another way around 🙂

--Eric

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

0 Kudos
Message 3 of 8
(3,516 Views)

@Eric.M wrote:

This is correct, there's no events for subpanel because it's a special type of controls. Most of the time, the events taking place on the subpanels are actually the events that should be handled by the VI inserted in the subpanel.


That makes it sound as if the omission of the SP is intentional. That doesn't sound right. While I understand the basic reasoning, it seems like there should be a separation between the events on the container (handled in the caller) and the events inside the container (handled in the subVI), and it looks like this separation  does exist (crashing aside), so I would expect it would be available in the list.

 

As for the crash, I haven't run into it myself (I don't think I ever needed events on the SP itself), but if workarounds are needed, I can think of a couple:

 

  1. Move the events into the subVI. Place a control in the BG of the subVI which will capture all the events that aren't handled by controls which are in front of it and use that.
  2. Place a control in the caller behind the SP and make it slightly larger than the SP, so that it forms a border. Then use the events for that control.

___________________
Try to take over the world!
Message 4 of 8
(3,506 Views)

Thanks, Eric and tst. I'll figure out another way, it just seemed an elegant solution to adding/removing a display (right click->add, right click->remove). this is not something that should be handled by the subvi, but by the main program. I'll try to figure out a less elegant solution...

 

Thanks all,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 5 of 8
(3,505 Views)

Hi tst,

 

I can't figure out how to have two people marked as solutions, so you get kudos 🙂 Thanks for the workaround suggestions. I agree, the omission shuoldn't be intentional.

 

Thanks,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 6 of 8
(3,499 Views)

If there are several of them, as your image shows, I would consider an XControl which would wrap the subpanel and an insert/remove button. Depending on your needs, you could also add code into the XControl which would allow the user to easily move and resize the XControl and, by extension, the subpanel.


___________________
Try to take over the world!
0 Kudos
Message 7 of 8
(3,490 Views)

I understood that XControls are much slower, and in this particular project I need top speed. Thanks for the suggestion, though!

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 8 of 8
(3,479 Views)