LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Different Instances of a Class

Gotcha warning!

 

Do not make the template part of the class. It MAY work in the development environment but in an exe LV does NOT concider the clone a member of the class so all private and protected methods can not be used.

 

Been there done that.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 11 of 14
(925 Views)

@Ben wrote:

If I understand you correctly yes a method will act on the Class instance in the wire it is passed. Provided the class instances are unique. 

 


Hi Ben

 

I have the following situation. I have a Graph Class consisting of a method with Graph Display as one method. I have a button(s) which when clicked will Create an instance of the class and Call the Graph Display method. Now, when i first click the button, the Graph Display launches. But when i Click on the button again it throws an error saying the "The VI is not in a state compatible with this operation."

 

I have attached an example of the same. In the example, i have created two static instances of the Graph Class. I have two buttons in the Front Panel each launching a different instance in a event structure.

 

Thanks and Regards

Suneel

0 Kudos
Message 12 of 14
(916 Views)

Did that link to my image library not work for you?

 

The last image in the series I posted for you is shown below but larger.

 

 

If you look at where I have included the comment "Open a re-entrant clone to use as an instance of the specified object" you will see I am using a switch to load the instance as re-entrant.

 

From the error message you reported I suspect the first instance is not being loaded and run as re-entrant so when you attempt to run load the second instance it opens a ref to the the first (after all it is NOT re-entrant) and an attempt to run an already running VI is a "right out".

 

If you want to get a better idea of the mind-blowing factors involved in re-entrancy and a simple example that was discussed at length by the community then please review my Nugget on Using Occurences that can be found here. It includes a zip of the code used in that Nugget and the topic of re-entrancy what beat to death.

 

BTW: I don't think LVOOP is your issue here. Using LVOOPish words in your question is limiting the potential number of readers/responders.

 

I hope that helps,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 14
(910 Views)

Hi Ben

 

I got, it worked. I had missed the reentrant option setting while calling the vi dynamically.

 

Thanks and Regards

Suneel

0 Kudos
Message 14 of 14
(906 Views)