07-10-2014 09:33 AM
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?
The basic question is "Is my conclusion that LVClasses are for data handling only, and useless for UI work, incorrect?".
If I have to pick out the stuff from the class and place it into another structure for screen editing, and then reverse that when saving, then that nullifies some of the data handling advantages that OOP might offer.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-10-2014 10:45 AM
But the whole idea of class data is that it is private. You can create accessor VIs to work with the class data, but the UI shouldn't be tightly coupled to your internal data -- whether in a class or not.
In fact, the whole point of modularity is to decouple the operation of one part of the code from the details of the operation of another part of the code. Why should your UI be tied to a particular data representation? That was part of the point I made in an earlier post. A strip chart at the data level is a scalar numeric, but at the UI level it's a graph with a lot of different interface features. (Although this idea can be taken too far through over-generalization.)
Mike...
PS: Want an idea, how about this one: You're thinking in the wrong language. Stop thinking in Object Pascal, C++ or whatever, and trying to translate into LV. It doesn't work because LV is a fundamentally different kind of computer language.
07-10-2014 10:55 AM
You're thinking in the wrong language. Stop thinking in Object Pascal, C++ or whatever, and trying to translate into LV. It doesn't work because LV is a fundamentally different kind of computer language.
OK, that's something I can use. I'm well aware that LV is fundamentally different, which is why I was thinking that maybe the UI connection was built into objects. It looks like there is no such connection.
Thanks.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-10-2014 11:05 AM
Just as an addition: Although clusters can be used in user interface panels for presenting data, I never do this. Plopping an ugly cluster onto my front panel is a hideous solution to creating data access points in my UI. I find that my user interfaces always require specific additional code to pull out the important information and present that in a unique way. Extra work? Sure, but it's always worth it / necessary.
I can see your frustration that LabVIEW classes don't allow UI visibility, but I personally wouldn't want that for the same reason I don't for clusters.
07-10-2014 11:08 AM - edited 07-10-2014 11:19 AM
Wow, Mike, kind of confrontational. I will respond when I have a chance, but I would like to point people to how web development works as a reference for more flexible separation of concerns.
With regards to X controls, I read that on LAVA sowewhere. There definitely are plenty of discussions about using X Controls as the visual representation of a class, but as for my exact comment I can't find the thread right now. I think AQ said it over there at one point.
And of course LabVIEW was OO, it just wasn't LVOOP. Look at VI server (or any API for that matter).
Actually, while writing this, I decided I am not going to bother responding in depth because it will just go downhill fast if that is the type of discussion we will be having. I'm all for standing behind your opinion, but man, take a breath.
07-10-2014 11:14 AM
Although clusters can be used in user interface panels for presenting data, I never do this. Plopping an ugly cluster onto my front panel is a hideous solution to creating data access points in my UI.
Hmmm. I have a different approach, which is perhaps why the question came up for me. I don't put ugly clusters onto my panels - I pretty them up and make them part of the UI. Sometimes they carry around related but not user-interactive stuff- those get stashed outside the borders.
I was just wondering if there was a similar possibility for Classes, but apparently not.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-11-2014 08:07 AM
@CoastalMaineBird wrote:
Although clusters can be used in user interface panels for presenting data, I never do this. Plopping an ugly cluster onto my front panel is a hideous solution to creating data access points in my UI.
Hmmm. I have a different approach, which is perhaps why the question came up for me. I don't put ugly clusters onto my panels - I pretty them up and make them part of the UI. Sometimes they carry around related but not user-interactive stuff- those get stashed outside the borders.
I was just wondering if there was a similar possibility for Classes, but apparently not.
I can appreciate that approach, but I find that prettied up clusters (including graphics etc.) use more memory. Consequently, all my subVIs that use the same cluster datatype are inflated in size. Multiply this over hundreds of subVIs and you have an avoidable problem.
07-11-2014 08:12 AM
@Thoric wrote:
@CoastalMaineBird wrote:
Although clusters can be used in user interface panels for presenting data, I never do this. Plopping an ugly cluster onto my front panel is a hideous solution to creating data access points in my UI.
Hmmm. I have a different approach, which is perhaps why the question came up for me. I don't put ugly clusters onto my panels - I pretty them up and make them part of the UI. Sometimes they carry around related but not user-interactive stuff- those get stashed outside the borders.
I was just wondering if there was a similar possibility for Classes, but apparently not.
I can appreciate that approach, but I find that prettied up clusters (including graphics etc.) use more memory. Consequently, all my subVIs that use the same cluster datatype are inflated in size. Multiply this over hundreds of subVIs and you have an avoidable problem.
Only if you use a Strict Type Defined Cluster. If you use a normal Type Defined, then you just have to pretty up the main GUI cluster. However, you do have the issue where your "prettiness" will magically disappear as soon as you change your cluster and you will have to rework it.
Such are the games we must play as engineers...
07-11-2014 09:13 AM
I find that prettied up clusters (including graphics etc.) use more memory.
I've never worried about that, because my definition of "pretty" doesn't include graphics. I'm talking about extra care with alignment, transparent borders, fonts, etc.
Occasionally, I'll make the cluster transparent and put a graphic behind it on the main panel - then the subVIs don't carry it around. But that's rare.
Blog for (mostly LabVIEW) programmers: Tips And Tricks