LabFrog Posted February 5, 2010 Report Share Posted February 5, 2010 Hi, I would like advise on the correct "labVIEW approach" to the following problem - I KNOW it is out there and I am sure it is because I cannot get myself out of OO-headspace. I have a set of data for a device (e.g. local/remote mode, substate, sim/no sim, name). From my c++/java background I naturally created a class to store and set/get this data - all well and good. Now I want to create instances of this class and display them on a front panel. Rather than copy/paste sets of GUI widgets for each class, I want to have a single GUI widget with a few LEDs and labels to display the device. In java I could create a pane or other class with the associated widgets, pass an reference to my object and display it. What is the equivalent in labVIEW? - build a component? This seems quite complicated, but if this is the correct way, an example, using a class, would be a great help. - build a subpanel and subVI with front panel? This seems most logical, however if the object is modified elsewhere on the front panel, the subpanel displaying the object will not update, as it contains a copy of the object, rather than a reference. I have attached a basic example, with 2 instances of a class. I can modify both objects on the front panel, but those in the sub-panels are not updated. I would really appreciate knowing the correct way of building simple, re-usable panels as "indicators for objects". Any and all advise very much appreciated! Thanks, The Lab Frog subpanel_example.zip Quote Link to comment
Daklu Posted February 5, 2010 Report Share Posted February 5, 2010 Labview OOP hasn't progressed to the point where classes can have display widgets automatically associated with them. We know this is an area of interest for Labview R&D but don't know when (or if) it will be implemented. I've found that I have to recreate almost all of the common object-based infrastructure that is readily available in other languages. There really aren't any higher level api's (like Swing) for LVOOP. Not being well-versed on subpanels, I'd probably look into building an observer GUI component from scratch that would update on the object's data changed events. However, I'm sure there are more direct ways to accomplish want you want. Quote Link to comment
LabFrog Posted February 9, 2010 Author Report Share Posted February 9, 2010 Hello, Thank you very much for the quick reply. I have been trying other strategies, but without luck. It seems, as you say, LabVIEW is not strong in this direction, and I will have to change my approach to the problem. Thanks again, will update the post if a better solution arrives! Regards, LF. Quote Link to comment
Synss Posted March 6, 2010 Report Share Posted March 6, 2010 This probably is not the approach you were thinking of, but I believe that the most convenient way to reuse GUI elements is to save them as controls (prefer typedef's or strict typedef's). This way, they are centralized and can be updated all in one place. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.