03-16-2018 08:40 AM
Hi,
I have a VI containing a Tab Control object that is typedef'd so that number and labels of tabs can be updated (for several programs).
On this main VI, I have placed several types of controls/indicators within the Tab Control and some are typedef'd (e.g. ComboBox).
I would like to pass references of these front panel objects into different SubVi's so that they can be updated. I am using a Producer-Consumer framework with the Producer being an Event Handler. What is the best way to do this? Should I bundle all the references (including both typedef'd and non-typedef'd) and create a typedef'd control from that bundle?
If anyone could point me in the right direction or a thread where this has been addressed, that would be greatly appreciated.
Thanks in advance,
Anton
Solved! Go to Solution.
03-16-2018 02:31 PM
@atrinh wrote:
Hi,
... Should I bundle all the references (including both typedef'd and non-typedef'd) and create a typedef'd control from that bundle?
If anyone could point me in the right direction or a thread where this has been addressed, that would be greatly appreciated.
Thanks in advance,
Anton
I would go with your approach.
If you want some inspiration and to get a look at how I have done similar take a look at the images in this Album.
if you look at each of those images, there should be a link included for each image that will let you see the thread were those images were used in a post.
I call it a GUI controller because it allows sharing control references and also serves to coordinate changes to related controls and indicators.
have fun!
Ben
03-19-2018 01:13 PM
Hi Ben,
Thanks for sharing the library of images. I've implemented something similar to what you posted in this thread and I wanted to take it one step further.
I have one (or a few) of my controls are typedef'd and I bundle their references with other non-typedef'd references. I create a control from the bundle and typedef this control. If I update one of the typedef controls, will this update the reference and also update the bundle of references? I thought this is how it would work but when I tried it, I would get broken arrows.
Anton
03-19-2018 01:43 PM
I left the end of the story out of that mini-nugget.
AFTER I create the type and save it I go back to the bundle and right>>> Preplace with a "BUndle by name".
I prefer the bundle by name because it can update with type def changes while the bundle has trouble.
If that does not take care of the issues you are seeing, please post some screen shots before after so that someone can peak over your shoulder and offer some advise.
Ben
03-19-2018 02:05 PM
Ah that worked! So does the "Bundle by Name" make the reference more specific that any changes will be translated to any instance where that reference is called?
I tested it out and placed an "Unbundle by Name" in a subvi to pull a reference to a typedef control from the main VI. I followed that with a property node to pull the value of this reference and display in an indicator. When I changed the typedef'd control (in this case it was a ring enum), no broken arrows in the subvi! However, I did notice that the front panel indicator did not reflect the change made to the typedef control. If I deleted the indicator and created a new indicator it did reflect the new changes. Is this normal?
Anton
03-19-2018 02:22 PM
Yes.
Rings unlike enums do not have a binding between values and the strings. Turn on your help window and use the wire tool over a enum wire and you will see the enum values are IN the wire. That is not the case with a ring type control.
If you want to have a tight coupling between a string and a numeric value, use an enum. If you want flexibility at run time, use a ring.
There is a property node for a ring that will let you read and or set the strings if that float your boat.
Ben
03-19-2018 02:41 PM
In reading your question, I found out that LabVIEW now supports typdef'ing tab controls. Thank you! Something I had wished for long ago....
03-19-2018 02:47 PM
@brucekr wrote:
In reading your question, I found out that LabVIEW now supports typdef'ing tab controls. Thank you! Something I had wished for long ago....
There was/is a bug in type-def-ing tabs controls. I was under a similar impression and then discovered it was working now (LV 2017 but not sure which version were/are buggy).
Ben