From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically obtain strictly typed control reference within TabControl within SubVI

Solved!
Go to solution

Hi, I am attempting to access a control refnum that is within a Tab Control within a separately opened VI. I have figured out how to do this but only if I use a "to more specific class" object with a strictly typed reference created within my "control VI".  The problem is that some of the other SubVIs I will be controlling will have different numbers of tabs and so I cannot just use one universal type reference. If I could just get the strict type of a TabControl from it's reference that would solve my problem. Is there a way to do this? 

 

Sorry, if my language is not correct as I'm still learning about this stuff. I've attached the SubVi that I'm trying to make which might help to understand. 

 

 

Download All
0 Kudos
Message 1 of 9
(3,420 Views)
Solution
Accepted by Ben

You may want to take a look at an old Nugget I wrote on exploiting Control references. It starts simple and goes all the way to save restore data to disk.

 

I do not think your reference have to strict they just have to be of the correct type.

 

Also loo k at the Variant palette because they have added a lot of things that make that work easier (where were they back in LV 8? So NOW they add them.)

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 9
(3,407 Views)

I do not think your reference have to strict they just have to be of the correct type.

 

 


Ah, this was the issue I was having. The problem was because I was creating a "VI Server Class" out of my control. Whenever I would change a tab name or remove a tab it would have issues. I fixed the issue by just creating a manually defined class specifier constant to use in the "to more specific class" object. 

0 Kudos
Message 3 of 9
(3,400 Views)
Solution
Accepted by leeaspitarte

You don't need to wire your Tab Control reference to the "more specific" VI.  Right click the "To more specific class" target class and create a constant.  Then navigate to the Tab Control under Generic->GObject->Control->PageSelector. 

 

In order for the Controls property node to return an array of all references on the front panel, it has to use a class that is common to all controls and it's up to you to cast them to the specific class in order to get at those properties that are specific to tab controls. 

 

Having said that, why not pass in the tab control reference to this subVI rather than iterating thru all the controls to find it?  You can create a Control Refnum on your front panel and set the class to be Tab Control. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 9
(3,395 Views)

Hint:

Spoiler
Ben's post was the solution...not your acknowledgment of his solution.
Give credit where credit is due.  Smiley Wink
aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 5 of 9
(3,385 Views)

@aputman wrote:

Hint:

Spoiler
Ben's post was the solution...not your acknowledgment of his solution.
Give credit where credit is due.  Smiley Wink

Maybe you could mark it as solution then?

Message 6 of 9
(3,335 Views)

Hello Wiebe,

I'm sure you know that only OPs can mark a solution.  Before you arrived to the conversation, the OP had marked his own response to Ben's suggestion as the accepted solution but has since removed that.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 7 of 9
(3,320 Views)

@aputman wrote:

Hello Wiebe,

I'm sure you know that only OPs can mark a solution.  Before you arrived to the conversation, the OP had marked his own response to Ben's suggestion as the accepted solution but has since removed that.  


Thank you for the concern!

 

While I do not think I have ever marked my own as a solution before today, the Knights of NI can mark solutions.

 

I marked BOTH mine and the reply by the OP. They go together in that I offered the hint and he identified what was the key issue.

 

Again, thank you for baking me up!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 9
(3,308 Views)

@aputman wrote:

Hello Wiebe,

I'm sure you know that only OPs can mark a solution.  Before you arrived to the conversation, the OP had marked his own response to Ben's suggestion as the accepted solution but has since removed that.  


That remark to mark a solution was directed toward OP.

 

Champions can mark solutions as well. I came to read this thread, hoping to help out. Only to find (what I though was) OP's "that is the solution" remark. Wasted 25 valuable seconds (and counting)... It's all good now.

Message 9 of 9
(3,297 Views)