03-11-2020 09:33 AM
I have written code to send a VI Refnum from one actor to another when the user selects a front panel control. The front panel of the nested actor successfully loads into a sub panel of the calling actor (using abstract messaging). All of the FP controls of the nested actor also load into the sub panel. However, I would like to make it so that one of the front panel controls is hidden (or changes) when it is loaded into the sub panel. For instance, a 'Dock' button could be used in the nested actor's FP, but then the 'Dock' would change to 'Undock' when the sub panel is loaded. I have tried all sorts of methods to do this. I tried passing a reference to the control using abstract messaging. However, since I am using an abstraction layer between the two actors, the reference to the control gets lost. This is odd because the VI server reference is not lost during transfer. I thought maybe there is a way to access these front panel controls through VI server, but I can't figure out how to do that either.
Any ideas???
Solved! Go to Solution.
03-11-2020 10:25 AM
IMHO from the point of view of abstraction and encapsulation it is more logical to control the panel of the VI from the last one, and not from the parent actor.
Also, this method will help to get a reference to the desired control.
03-11-2020 10:38 AM
If you're sending the subpanel reference to the nested Actor to embed itself, then the caller can access the VI via the subpanel's property node - "InsertedVI". Note this won't necessarily be a valid reference when you send the message - only when the receiver embeds itself.
From there, you can probably parse the Controls[] or similar to get the control you need.
If you're instead having the nested Actor send the VI reference (your post wasn't super clear to me) then you already have the reference. You might be launching a clone (Actors typically have many VIs marked as shared reentrant) in which case the reference might be to the "real" VI, rather than the specific clone which is embedded. The simple solution is to have the nested Actor tell its own VI to change the FP items as needed, since it's providing the reference to the VI. Reading the detailed help for the Open VI Reference might be helpful (there's a section at the bottom about clones) if you're using that.
If this post doesn't solve your issue, perhaps you could try and produce a small example demonstrating the problem that forum users (myself or others) could fix for you and explain the issue?
Or maybe you can explain in more detail (but the example might be faster/more accurate a fix).
03-11-2020 01:15 PM
Thank you. That worked! The issue I was running into was not knowing which index to choose (from the array of control references). I was just trying them by trial and error.
03-11-2020 01:17 PM
Thank you. I had tried many different options, but using the nested actor's reference, as you point out, is jus much easier. I just wasn't sure which combination of property and invoke nodes I needed to find the specific control reference I wanted to disable/hide.