LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

progammatically determine what pane a control is in

I would like to pass a control reference to a subvi and have the subvi determine which pane the vi is in.  Is this possible?
Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 1 of 9
(3,134 Views)

As far as I know there's no direct way of doing this, but I'm only working in 8.2, so I don't know if the situation has changed in 8.6. You can, however, use property nodes to get the owning VI from the control reference, and then from that get the front panel object, and then from that get the panes[ ] array, and then for each pane get the list of controls, and then for each control you can see if the label matches your control's label. If so, you've got your pane.

 

If someone knows of a slicker way I'd love to hear it. Smiley Wink

Message 2 of 9
(3,129 Views)
Thank you.  It sounds like I was on the right path, I just didn't think of the last step of comparing the list of controls on each pane to find the owning pane.  It might be a long process but it makes it programmatically possible.
Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 3 of 9
(3,122 Views)
> I would like to pass a control reference to a subvi and have the subvi
determine which pane the vi is in.  Is this possible?

If you mean by "which pane the vi is in" the subpanel the VI is in, then no.
Sadly, this is not possible. NI forgot to make two functions: one to get the
VI that is in a subpanel, the other to get the subpanel a VI is in... (At
least for version up to and including 8.5. Somebody please tell me this is
solved in 8.6...)

Regards,

Wiebe.


0 Kudos
Message 4 of 9
(3,116 Views)

See the attached example: (LV 8.5)

 

Move the controls and indicators named in the enum between the two panes and run; it will return a reference to the pane the control is in...

 

Message Edited by Phillip Brooks on 09-24-2008 02:06 PM
Message 5 of 9
(3,091 Views)
The purpose of my asking was to find a easy way to determine the screen cordinates of a specific control.  I have succeeded with your help.  Here is the vi I created.  Please give feedback.  Thank you all again.
Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 6 of 9
(3,079 Views)

Hi Philip, 

 

Your GObj >> Obj Highlight method is throwing out error in my PC. Smiley Surprised When I click on that invoke node, it does not show that method at all. Smiley Indifferent

 

What caould be the reason? Is it a private method?

- Partha ( CLD until Oct 2027 🙂 )
Message 7 of 9
(3,060 Views)
You should note that both examples do not account for controls within containers (tabs or clusters). To do this, you can get the control's Owner property and climb up in a for loop until you reach a control who's owner is in the Panel class.

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

Another attempt is found here

It doesn't account for tabs or clusters.

But  here (in sourceforge) is a version that accounts for those obscure facts.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 9 of 9
(3,036 Views)