09-12-2017 08:10 AM - edited 09-12-2017 08:11 AM
@volfi wrote:
Is it also possible to have only on subpanel (placed outside the tab control) and depending on which tab is activated change the subvi which is loaded to the subpanel ?
Yes of course. You only need to change the loaded VI in the subpanel when the user changes tabs. (pretty similar to the code of your first try)
But why would you use a tab control for that anyway? The tab control is mainly used to organize frontpanel elements. In your case two subpanels. If you only have one subpanel there isn't much left to organize. So I would let the user change the loaded sub-VI via a button or an enum instead.
Best regards
09-12-2017 08:17 AM
Ist just something I wanted to try, I know you'd never use it that way.
I tried to implement it loading a different path in each tab, however the front Panel does not respond when I change tabs. Could you give me a hint?
09-12-2017 08:24 AM
volfi wrote: Could you give me a hint?
My hint is: you might need to read some basics about the event structure first. Maybe have a look at some examples. And when you are new to event structures keep in mind that in 99% of all cases you only need one single event structure. (not two as you have in your code)
Best regards
09-12-2017 08:44 AM
@volfi wrote:
thanks that does the Job! Is it also possible to have only on subpanel (placed outside the tab control) and depending on which tab is activated change the subvi which is loaded to the subpanel ?
This is precisely the suggestion I made earlier, except instead of a Tab Control (which is clumsy, problematic, etc.), use something like a Boolean Radio Button control or an Enum or a ListBox or a Boolean (if you have only two choices), anything except a Tab Control.
Bob Schor
09-12-2017 08:59 AM
Ok thanks. How can I change between two different cases (the two different paths) with only one Control in an event?
09-12-2017 09:12 AM
@volfi wrote:
How can I change between two different cases (the two different paths) with only one Control in an event?
I would load and start the sub-VIs in a FOR-loop to get an array of VI-references. Then use an enum to index this array in the event of a value change of this enum.
This makes your code quite simple, plus you can add as many sub-VIs to your enum as you want in the future without much effort.
Best regards
09-12-2017 10:17 AM
Improving upon the earlier response from 'crabman', this makes the front-end a little simpler.
09-12-2017 10:58 AM
I tried to do as you suggested. There is however an error when I read the VI reference from the Array. Where is the Problem?
09-12-2017 11:08 AM
You are reading an empty array of default VI references. You aren't using the array of references that you built up before the loop.
09-12-2017 11:48 AM
Your front-end doesn't look at all like I showed. As RavensFan had mentioned, you pass the array into the Event structure then choose to ignore that array as the input to the Index Array. Additionally, you are only closing the current panel upon exiting the loop. This may cause problems later with the other panels still open then re-running your _top.vi and NOT being able to access the unclosed vi. It may not show as an error for it will try to open a copy of the original slide_?.vi