LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

OOP usage in UI

I'm an old hand at LabVIEW in general, and using Object Pascal, C++, etc (other object-oriented languages), but I'm trying to use LabVIEW objects and not having any luck.

 

I understand the trivial examples, about graphical shapes, and such, but I see no example making a real use of them.

 

Consider this:

I have a SCALER, which is a cluster of {A,B,C,D,E,FullScale, all numbers}.  I'm thinking of making that a class, so I do that.

 

I have a CHANNEL, which has a NAME, an ACTIVE switch, and a SCALER.

 

If I put the SCALER.lvclass into the private data for CHANNEL, then I get a icon of a box. It's pretty and all, but not useful for a user interface.

 

If I put the SCALER.ctl into the private data for CHANNEL, then I get the cluster I want to see.  But it's not an object.  If I want to use the SCALER object methods on this data, the I have to create an object and set it to this value, don't I?

 

That's hardly a sensible approach.

 

I have a MODULE, which has a MODULE TYPE, some module-level stuff, and an array of CHANNELs.

Now, for reasons I don't understand, If I put a CHANNEL.ctl -OR- a CHANNEL.lvclass into the array in MODULE's private data, I get an array of the box icons.  That's hardly useful for UI.

 

Are LabVIEW objects just not suitable for UI purposes like this?

 

Or is there something else I've missed?

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 19
(3,428 Views)

Not sure if this will help, but I just started playing with XControls.  That may be what you are looking for.

0 Kudos
Message 2 of 19
(3,419 Views)

<shameless_selfpromotion>

        If you aren't doing anything special Tuesday of NI week from 4:45 to 5:45, I have a recommendation...

<\shameless_selfpromotion>

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 19
(3,410 Views)

@mikeporter wrote:

<shameless_selfpromotion>

        If you aren't doing anything special Tuesday of NI week from 4:45 to 5:45, I have a recommendation...

<\shameless_selfpromotion>

 

Mike...


Will the presentation be available for download later?

 

 

0 Kudos
Message 4 of 19
(3,377 Views)
I think that is NI's plan...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 19
(3,368 Views)
Those boxes are no different from a class pointer in C, not very UI friendly. What you'll need is a UI control which shows the interesting information from the Class, this is the same as in C or any other language. So what's the question?
/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 19
(3,346 Views)
I think one of the initial reasons for xcontrols was to allow the programmer to create a visual representation of a class. The problem here is they ended up not being as straightforward as I believe NI had hoped. Yamaeda is right, this is just like any other OO language. Classes don't have a visual representation. The issue is LabVIEW so tightly couples UI elements to datatypes that we become blinded to the separation of the two. It is one of the reasons why it is pretty much impossible to actually implement MVC in LabVIEW. Using purely LabVIEW your view is always coupled to procedural code.
0 Kudos
Message 7 of 19
(3,322 Views)

Hmmm... Where to start...

 

"...the initial reasons for xcontrols was to allow the programmer to create a visual representation of a class."

 

Really? I have never heard that --- and it certainly isn't in any of NI's description of XControls. XControls are for creating user interfaces, plain and simple. Of course using them as a way of providing class-specific interfaces, while I have never seen it done, is a neat idea.

 

"...LabVIEW so tightly couples UI elements to datatypes that we become blinded to the separation of the two."

 

What are you talking about? This doesn't make any sense on its face. A strip chart to the user is a graph with all kinds of controls and properties. To the code it is a scalar numeric indicator. Or you are saying that I should be able to wire anything up to a strip chart and let LV decide what I want? No thank you! We already have the dynamic data type and it causes problems enough.

 

"...it is pretty much impossible to actually implement MVC in LabVIEW."

 

Again, what in the world are you tralking about? MVC is a technique of understanding and defining the relationships between the various aspects of your application. A technique, by thte way, that is language independent. I first ran into the terminology in the discussion of website. Let me guess, you are one of those people that think LV wasn't object-oriented before LVOOP was introduced, right?

 

"Using purely LabVIEW your view is always coupled to procedural code."

 

Well, duh... The point of the View (the V part of MVC) is to "request information from the model that it uses to generate an output representation to the user". Now how is it to do that without procedural code? Without code how do you formulate or send a request? How do you process the response to that request? How do you generate an output representation?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 19
(3,288 Views)

@GregFreeman wrote:
It is one of the reasons why it is pretty much impossible to actually implement MVC in LabVIEW.

Greg obviously wan't at the CLA summit a few years ago where all we did was talk about Model-View-Controller.  We had some interesting solutions, including Queues, Events, and Actor Framework.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 19
(3,281 Views)

 If you aren't doing anything special Tuesday of NI week from 4:45 to 5:45, I have a recommendation...

 

 

So, rather than offering an idea, you're pimping for your conference presentation in a couple of weeks?

 

OK, thanks.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 19
(3,280 Views)