LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the value of a control that is a class object when testing a class member function?

When making a new sub-VI that does work on arrays, for example, I try to make them self-contained so that I can test them easily with no upstream dependencies.  This is easy to do by changing the array control on the front panel.

 

For class member functions, like a new static dispatch VI, all I see on the front panel is the class "cube" which execute with the default values of the class private data controls.  Is there any way to change/set these from the front panel for testing?

 

Thanks.

0 Kudos
Message 1 of 5
(2,962 Views)

Hi jordanglassman

 

That depends on the type of class you created. I mean, it depends on the class which the control has inheritance.

 

Please check this and tell us if it is helpful:

 

http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/creating_classes/

 

Thanks!

0 Kudos
Message 2 of 5
(2,897 Views)

Why should inheritance matter?  Let's consider a simple class, a class with several numerical members, X, Y, and Z.  Now let's say I create a static dispatch member that does some complex algoirthm on the data members.  I want to see if given a certain input class state, I get the right output, A, B, and C.

 

Is there any way to set the numerical input values, X, Y, and Z,  from the front panel for testing?  As far as I know, the only way to do this is to make/call the class initializer in a simple testing VI and then insert my SubVI in this VI.  Easy, but a large extra step.

0 Kudos
Message 3 of 5
(2,890 Views)

In some way it matters, but you are right, I did not understand the question.

Please read the last section of this link: http://labviewwiki.org/LVOOP_Frequently_Asked_Questions

 

I would also try the property node: Method although I am not sure if it is what you want

0 Kudos
Message 4 of 5
(2,869 Views)

It's not a simple solution, but you can create an xctl.

 

In the xctl. You'll set the data to type of class.

In the class, you give all your accessor methods you want to use as community scope and give the xctl friend access.

Then you write the facade to show your private data and handle the data events (example attached)

 

Here's a basic example with three numerics. And calling the DoSomething function with class cubes vs xctl.

 

Actually, there's another example loaded with LabVIEW: examples\lvoop\FriendshipCommunityScope

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 5 of 5
(2,858 Views)