Jump to content

correct model for updating a subpanel


LabFrog

Recommended Posts

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

Link to comment

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.

Link to comment

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.

Link to comment
  • 4 weeks later...

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.