LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to edit LVOOP object constant?

Does exist any easy (or even more complicated - programmatically) way to edit LVOOP object constant ?


*** LV2018 ***
0 Kudos
Message 1 of 13
(3,509 Views)

Are you talking about the class private data?

Anyways, you have to use LV development environment to modify things like that...

 

Maybe this helps you.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 13
(3,505 Views)

Lets say I have LVOOP class. Its private data (ctl) has some implicit values, always the same for all instances.
I need some instances to have different values from app start. I'm looking for the most simple way to solve this.

 

Solution A: create some "init value" static method for every class. And initialize all instances after app start. So non- implicit values = input of "init" method. All init calls collected in some VI. However this solution needs init method for every class, a lot of wiring (for every instance). Complicated.

 

I wonder if is it possible to edit object constant directly in LV environment. I know I can copy non implicit object data and paste to another object constant. But I need some edit phase to change that data.

 

Any ideas?


*** LV2018 ***
0 Kudos
Message 3 of 13
(3,502 Views)

You can define default values in the private data of a lvclass as the private data is a cluster.

Every instance of that class will start with those default values, but it is highly recommended to add some "init" methods to clearly define the values from a caller point of view. Otherwise you rely on crypting data values coming from "somewhere"....

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 13
(3,498 Views)
As far as I can tell, there's no way to change the values inside an LVOOP object on the block diagram, or on the front panel. (But you might be able to do something with XControls).
"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 13
(3,467 Views)

Does it mean that private data are random? I dont think so. It should have implicit value, right?

 

I don't need general advice. I know all that. I'm looking for specific methods/ideas... how to edit these values during project editing.


*** LV2018 ***
0 Kudos
Message 6 of 13
(3,457 Views)

@petrnowak wrote:

Does it mean that private data are random? I dont think so. It should have implicit value, right?

 

I don't need general advice. I know all that. I'm looking for specific methods/ideas... how to edit these values during project editing.



No, they're not random.  When you drop an object on the BD or FP, the private data contained therein will be the default values in the class definition.  Although it's easy enough to change that, you said you wanted "some" of the instances to have different values.  The only way to do that is to with code that changes the values at runtime.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 13
(3,430 Views)

@petrnowak wrote:

Does it mean that private data are random? I dont think so. It should have implicit value, right?

 

I don't need general advice. I know all that. I'm looking for specific methods/ideas... how to edit these values during project editing.


Here's an example of how to do something like that with an XControl.

Note: Using LVOOP objects inside XControls comes with a yuge caveat:

Whenever you make any change to the class definition, you should open & resave all XControl components that reference that class.  Failure to do so can result in a LV crash the next time you open any VI with an instance of that XControl.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 13
(3,412 Views)

Create a dummy VI where you bundle in all the values of the class that you would like, and create an indicator of the class. Run the vi, right click the indicator, and select data operations>copy data, then you can paste that class constant on the block diagram, and it will have the values you put in. It will also show up on the diagram with a black outline. 

 

Note that this is a terrible practice, and you shouldn't do it. How are other developers (or you in 6 months) supposed to know what data is in the class? As others have suggested, create an init method where you can set the data you want, and you can see what data the class is being loaded with. 

0 Kudos
Message 9 of 13
(3,399 Views)

Well, you could use this (if you find it handy, put it in C:\...\National Instruments\LabVIEW xxxx\project\)

Run the program.  Then click on an object (FP or BD).  You will be able to see & edit the data inside the object.

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 10 of 13
(3,384 Views)