LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView classes

Hi. I just start to learn labview classes. And I have some questions:

  • How to make a subProperty in class property definition folder? Like this:

chan.name.font.color

chan.name.font.bold

chan.number

  • What is diferent with dinamic and static accessors?
  •  And how to create object of some class?

Parameter of class Parameters

Thank you forward.

0 Kudos
Message 1 of 6
(5,399 Views)

@0Forest0 wrote:

Hi. I just start to learn labview classes. And I have some questions:

  • How to make a subProperty in class property definition folder? Like this:

chan.name.font.color

chan.name.font.bold

chan.number

  • What is diferent with dinamic and static accessors?
  •  And how to create object of some class?

Parameter of class Parameters

Thank you forward.


You should really go through the tutorials for LabVIEW Classes (the help manual is actually quite good here in my opinion). But to answer your questions:

  • You can't make "sub-properties". A property is simply a convenient short-hand for a method call, which is actually how it is implemented. In this instance, to keep things simple, you could have properties "Font Color" and "Font Is Bold" on the "Named Channel" class.
  • Static assessors are class instance methods. The logic executed in that method cannot be over-ridden by a child class (the connector pane is solid for the class inputs/outputs). Dynamic accessors use polymorphism - it means that a child class can over-ride this method with a new method that will execute if that particular child class is what is passed to the class input (the connector pane is fuzzy for those input/outputs). In other terminology, the static method is "sealed" whereas the dynamic method is "virtual".
  • You drop an object constant on the block diagram to create an instance. The easiest way to think of objects in LabVIEW is that they are basically just like clusters - just with an identity as to it's type to enable dispatch, special behavior for executing dynamic dispatch at run-time, and some enforced constraints in the IDE at compile-time / run-time such as encapsulation of data.
Message 2 of 6
(5,333 Views)

A slight caveat to tyk007's answer about sub-properties.  If by sub-properties you mean a sub-menu like appearance in the property node when calling the property, you can do that by right-clicking the class in the project manager and selecting properties, then in the properties window select Item-Settings and in the Contents tree-menu select the correct property folder and change the Long Name of the folder to something like 'chan:name:font:color' for the color property.  Each ':' in the name will translate into a sub-menu arrow.

Jon D
Certified LabVIEW Developer.
Message 3 of 6
(5,319 Views)

I looked forever for this. Where is this documented?

 

Thanks Mythilt!

0 Kudos
Message 4 of 6
(5,105 Views)

This forum post is asking about a similar thing and has a good explanation:

http://forums.ni.com/t5/LabVIEW/lvclass-property-node-sub-menu/td-p/3242862

 

And it links to the following help document, which shows how to make the sub-menus.

http://zone.ni.com/reference/en-XX/help/371361M-01/lvdialog/c_item_lib_page/

Maggie M.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 5 of 6
(5,079 Views)

Creating subProperties is possible; but the process is ugly.

  1. Name your property folders with periods separating the hierarchal levels:

     

    chan.name.font.color

     

     

    chan.name.font.bold

     

     

    chan.number

     

  2. Edit the .lvclass file with a text editor:
  3. Find all instances of your property names, and replace the periods with colons:

 

chan:name:font:color
chan:name:font:bold
chan:number

Clipboard.png 

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 6 of 6
(5,071 Views)