08-19-2010 09:52 AM
Hi,
Im trying to trigger an event in a sub VI. I've tried two things:
-pass reference of a control that should trigger the event into memory, read it and make a property node 'value signaling' for it. It accepts variant so I wired a 'true' to it, and converted this to variant. Didnt work.
-Opened the VI reference, selected method for control and I can change then control values by name. Of course didnt work. Is there a way to get this done through VI reference, I prefer this
over the first thing. Of course, I need a solution in general
Thanks!
08-19-2010 10:25 AM
Search for 'sub vi event' in the search utility and they should be suggestions on how to achieve what you are looking for. If you still have questions, please post back.
08-19-2010 11:03 AM
Hi,
find the attached VI where you can trigger event from SubVI. Let me know this what are you looking for?
08-19-2010 11:17 AM
@_Faust wrote:
Hi,
Im trying to trigger an event in a sub VI. I've tried two things:
From where? Do you want to change a value in the main vi and cause it to trigger an event in the subvi? Or is it the other way around?
08-19-2010 11:57 AM
Can you describe what it is that you are trying to achieve? (the overall goal)
I'm not looking for an explanation of what you 've tried... I'm trying to understand why you want to implement the solution that you are trying to implement.
Plus I agree with tbob...
Which way do you want to pass the info? To or From the sub-vi?
08-19-2010 02:24 PM
This uses events and does what you want. It is a little more complicated.
Let me know if you have questions.
08-20-2010 03:12 AM
Guys,
It was working when I changed the boolean to a numeric. Dont know why it wasnt working with the boolean.
Bottom line is, can I achieve it through opening a reference to a VI only? I dont want to pass around too many control references.
08-20-2010 03:16 AM
BTW what Im trying to achieve:
I have different user levels 1,2 and 3. For each level, some controls are disabled. I have a cluster with these 3 arrays, and it is in memory. When the app is started, all references are written to this from all VIs and sub VIs.
The event I described is somewhere else, and all it does is load a different config file for the user -his settings in the prog-.
So now I have one other question regarding this array with references: Suppose I am looking for a reference to a specific control, can I find it in the array by searching for its name or something? Or should
I make an identical array with control names and put this in the same cluster. Searching the name will give the location of the correct reference in the other array then.
Thanks.
Felix
08-20-2010 08:10 AM
Was the boolean a latching button? I've had some problems with booleans->variants before, as you mention it often works better with numbers.
/Y
08-20-2010 05:02 PM
@_Faust wrote:
So now I have one other question regarding this array with references: Suppose I am looking for a reference to a specific control, can I find it in the array by searching for its name or something?
See the attached picture. You can see that each control reference has a property node for Label.Text. This is the control's name (or commonly called a label). So you can form an array of names, search for the name you want. The index of the name found will be the index of the control reference in the controls array. You can use this index to extract that reference.
The picture shows two methods for retrieving the names. The top one uses a controls array build manually. The bottom one shows how to use property nodes to get the Front Panel controls array. It is already built for you. No need to build any control arrays on your own. Warning: Even though an indicator is called an indicator, all indicators will show up in the Controls[] array. The array contains all controls and indicators. There is also a property node choice for Objects and Decorations. I think Objects includes all controls, indicators, decorations, anything that can have a label.