LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a reference to an xcontrol in a class

Solved!
Go to solution

Hi.

 

I want to use dynamic dispatch OOP-methods to write to Xcontrols on the front panel of the main VI. In the image below, I have illustrated a very simple example, using static methods.

However, as soon as I introduce a strict reference to the Xcontrol anywhere into the class, the Xcontrol becomes locked, even when all VI's of the project are closed. I know, I can unlock the Xcontrol, edit it and lock it again.

However, in my real project, I have an additional Singleton that is used both in main as well as in one of the Xcontrols. This class then becomes completely locked meaning that there is no possibility any more to edit it from within the project or do a search for callers. The latter is quite annoying as this makes any search for callers impossible, as the search is done on VI's in memory.

Is there a reason for this locking, when nothing but the project is open, is there some alternative solution?

 

Herbert

 

XCtlRef ScrShot1.jpg

0 Kudos
Message 1 of 4
(3,321 Views)
Solution
Accepted by topic author Herbert

@Herbert wrote:

Is there a reason for this locking, when nothing but the project is open, is there some alternative solution?


I don't have experience with this, so I'm not aware of a solution, but you can search to find other people asking about this, as it has come up before. Basically, classes load all their VIs when they load (which happens when you open the project). When a VI calling an XCtrl is loaded, it locks the XCtrl. Combine the two and there's your reason.


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

Thank's tst,

I really was not aware that all classes, and maybe also lvlib's, load into memory on opening the project. This makes everything clear and I have to get a better solution to my use of a singleton in the Xcontrol.

This is probably better anyway, as the Xcontrol becomes more independent of the rest of the code.

 

Herbert

 

0 Kudos
Message 3 of 4
(3,175 Views)

@Herbert wrote:

 

I really was not aware that all classes, and maybe also lvlib's,


lvlib no, lvclass yes and I think also xctl and xnode, although I'm not sure about those.


___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(3,155 Views)