07-21-2010 03:47 PM
@sdsdsd wrote:
Thanks bob, that makes sense. So the use of Sub panels would be best for "windows" that only display?
Whereas if I wanted to have user input in each "window" (maybe better named a dialog?) it seems the best method is individual VIs (where once each button is connected to the VI for the subsequent window).
No. You can have controls inside your subvi's that are in subpanels. The subpanel contains a fully functional subvi, controls and all. What I was saying is to put the ability to change your subpanel's subvi in the main vi. Look at my code. There are selection buttons in the main vi just below the subpanel that allows the user to choose which subvi to place inside the subpanel. However, each subvi placed inside the subpanel can have controls that the user can manipulate. The reason for putting the selection buttons in the main is that the subpanel is in the main. If you tried to put a button in First vi to place Second vi inside the subpanel, you would have to pass a reference of the subpanel to the First vi so that it can unload and load. But how can it load the Second vi after it has unloaded itself. See what I mean. Subpanel controls in the main only, subvis can have all their own controls.
07-30-2010 09:23 AM
Sadly, that file doesn't work in LabVIEW 8.5.
On a seperate note, I've been thinking about this a lot and from your explanation I understand that your example has buttons outside the subpanel to change which SubVI is displayed. Is it possible to have the buttons change depending on what SubVI is currently displayed?
I expect this would be implemented with some sort of hiding method, but I haven't been able to figure out how. I tried using clusters but could find a method of hiding certain clusters.
Thanks for the help.
07-30-2010 11:28 AM
I thought I had attached my example in 8.5? It should open. What error message are you getting? It won't run properly until you change the paths on the left side of the code. Put in the paths to the VIs you want to display in the subpanel. Change the names of the buttons to reflect your VIs names.
You can have a different set of buttons show and hide dependent upon which subvi is in the subpanel. Create all the buttons and place them where needed, even if some overlap. Then use the Visible property node to show and hide them. You can do the same with a cluster. Using the wiring tool, right click on the item, and select Create - Property Node - Visible. Wire a True to make it visible and a False to hide it. In a case structure where you select which vi to show in the subpanel, you can put in code to hide some controls and make others visible.
04-13-2011 10:24 PM
Hi tbob,
I hope you can still reply to this message.
Here's what I am trying to do. How can I load multiple subVI's front panel and view them simultaneously? I've seen this feature in several VB-based programs, where upon clicking a button or menu, a window pops in the main diagram. Without closing the first window, the user can then load a second and third window and subsequently rearrange these windows to fit the center of the main program. I've attached an example of how it looks like with only one window open.
I'm trying not to load the subVI's front panel as another window (or even dialog boxes) as when a couple of these opened at the same time, it may get messy. I'm trying to contain everything within the main program... Any ideas?
Thanks.
04-13-2011 10:46 PM
Maybe Ben's example in this post can guide you.
04-13-2011 11:55 PM
Hi Raven
That's not quite what I was looking for. Please refer to two attached images. What I would like to do is when I click the button Initialize, the front panel for subVI 1 shows up. Then, when I click button discharge, the front panel for subVI 4 shows up (as can be seen in Example1.jpg). Later, I can edit the settings and close one of the front panels (in this case, the front panel for subVI 4), open up other two front panels (for subVI 2 and 3) and resize them to fit the screen underneath the buttons. Any ideas?
Anyhow, Ben's example is very nice, though, and I believe it can be used in my other project. Thanks for sharing!
Shazlan
04-14-2011 07:57 AM
@Shazlan wrote:
Hi Raven
That's not quite what I was looking for. Please refer to two attached images. What I would like to do is when I click the button Initialize, the front panel for subVI 1 shows up. Then, when I click button discharge, the front panel for subVI 4 shows up (as can be seen in Example1.jpg). Later, I can edit the settings and close one of the front panels (in this case, the front panel for subVI 4), open up other two front panels (for subVI 2 and 3) and resize them to fit the screen underneath the buttons. Any ideas?
Anyhow, Ben's example is very nice, though, and I believe it can be used in my other project. Thanks for sharing!
Shazlan
Isn't that my example inside out?
I suspect you can get where you want by working with subpanels, multiples, that are repositioned and sized within the main GUI.
Ben
04-14-2011 09:19 AM
Hi Ben,
Sorry, but I don't get what you are saying, I hope you can bear with me. With a subpanel, I can only load only one subVI at a time. So, to load a few subVI's simultaneously, are you suggesting that I use multiple subpanels? Then, as the user wants to move or size the one of the front panels, I use the subpanel's property node to make the necessary changes to its size and/or postion by tracking the distance the mouse has moved... am I correct? I haven't done this before but won't this consume lots of computer resources? Please advice.
Thanks.
04-14-2011 09:27 AM
@Shazlan wrote:
Hi Ben,
Sorry, but I don't get what you are saying, I hope you can bear with me. With a subpanel, I can only load only one subVI at a time. So, to load a few subVI's simultaneously, are you suggesting that I use multiple subpanels? Then, as the user wants to move or size the one of the front panels, I use the subpanel's property node to make the necessary changes to its size and/or postion by tracking the distance the mouse has moved... am I correct? I haven't done this before but won't this consume lots of computer resources? Please advice.
Thanks.
You read my mind well, thank you!
Re:Consuming resources
Durring the layout changes there will be hit on the CPU yes. Provided you implement the code cleanly the major concern I have lies in the potetial of having over-lapping objects.
To protect yourself, I suggest you keep the task manager open as you are testing your code so you can spot changes that hit your CPU as early as possible. If you get stumped post-up examples and let the gang advise.
Take care,
Ben
04-14-2011 09:59 AM
Thanks Ben. I shall test this this weekend. Anyway, is your concern on overlapping as shown in the attached image? where the second workbook is on top of the first. May I know why is this bad? Also, let say the first workbook is on subpanel A and the second workbook is on subpanel B, how do I programmatically change so that subpanel A is in front of subpanel B? I've looked at the invoke and property nodes of the subpanel and found nothing that suggest this...