LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I put a subpanel inside another subpanel?

Hi,

Is it possible to put one subpanel o several subpanels inside one main subpanel?

Thanks,

ToNi.
0 Kudos
Message 1 of 21
(4,888 Views)
Maybe you can use a small "trick" (I'd test it this way): create a new VI with some subpanels and include *this* VI in another subpanel in your application. I think a direct include of subpanels into other subpanels is not possible (doing something like with clusters).

Cheers,
Carsten
0 Kudos
Message 2 of 21
(4,862 Views)
Exactly, what I want is:

I have a main.vi with a subpanel. Then, I want to load inside the subpanel of the main.vi others windows(vis), but I want to load several vi inside, not one and I want these windows(vis) have its title bars and that they can minimized and maximized inside the subpanel. I don't want they can go outside the subpanel. I want to simulate a MDI. Parent my subpanel and the childs, the other windows I want to load inside it.

Thanks,

ToNi.
0 Kudos
Message 3 of 21
(4,850 Views)
You can create something in LabVIEW to do this, but it won't be trivial. Here are some things to point you on your way. I have not done this, so it is pure speculation on how I would go about solving this problem.
  • You will need to know ahead of time the maximum number of windows you will want. On your front panel, create that many individual subpanels. You can hide the border and make them transparent so you never see them unless something is in them.

  • When you load a VI into the subpanel, all you get is the panel, not the title bar. You will need to create a title bar with buttons and any border you want on the VIs in the panel area. This is tedious, but fairly straightforward, especially if you use system colors to make it look like a real title bar/border. You won't be able to make it look like an XP title bar unless you use bitmaps/picture control. If you go that route, you can probably even mess with the color map to change the bitmap colors when the system color changes (have to poll, no event for system color change).

  • You can resize and move the subpanels using property nodes. Getting the info to do this could be tricky, however, since you may be coordinating mouse events from the top level VI and the VI hosted in the subpanel. Should be doable, though.

  • One other method is to use floating windows, but move them on top of your main window so it appears to the user it is an MDI. You won't get clipping, but everything else will look the same and you won't have to jump through hoops to create title bars, etc. You will have to write a position manager to maintain the window positions, but that is probably easier than the tricks I discussed above
Good luck. One final question - do you really need an MDI? Floating windows with clear labels are a lot easier. Do some polling of your users to find out what they like best, then go for it.
0 Kudos
Message 4 of 21
(4,836 Views)


@DFGray wrote:
You can create something in LabVIEW to do this, but it won't be trivial. Here are some things to point you on your way. I have not done this, so it is pure speculation on how I would go about solving this problem.
  • You will need to know ahead of time the maximum number of windows you will want. On your front panel, create that many individual subpanels. You can hide the border and make them transparent so you never see them unless something is in them.

  • When you load a VI into the subpanel, all you get is the panel, not the title bar. You will need to create a title bar with buttons and any border you want on the VIs in the panel area. This is tedious, but fairly straightforward, especially if you use system colors to make it look like a real title bar/border. You won't be able to make it look like an XP title bar unless you use bitmaps/picture control. If you go that route, you can probably even mess with the color map to change the bitmap colors when the system color changes (have to poll, no event for system color change).

  • You can resize and move the subpanels using property nodes. Getting the info to do this could be tricky, however, since you may be coordinating mouse events from the top level VI and the VI hosted in the subpanel. Should be doable, though.

  • One other method is to use floating windows, but move them on top of your main window so it appears to the user it is an MDI. You won't get clipping, but everything else will look the same and you won't have to jump through hoops to create title bars, etc. You will have to write a position manager to maintain the window positions, but that is probably easier than the tricks I discussed above
Good luck. One final question - do you really need an MDI? Floating windows with clear labels are a lot easier. Do some polling of your users to find out what they like best, then go for it.





You should using windows reparenting functionality through windows api dll calls. Reparenting is documented well on microsoft.com. Reparenting is how Excel opens multiple worksheets inside the Excel "parent" window. I have done this on a few of projects and it works far better than subpanels because it allows you to drag windows around within a parent application. They are also far easier to work with once you get the reparenting vi's correct (you have to do some messing with Z position and window activation to get them to repaint properly) because unlike with subpanels you can view a VI diagram while it is reparented with no problem. With subpanels I have also had problems with GUI controls driving event structures when a vi is in a subpanel.
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 5 of 21
(4,763 Views)
billings11...

This sounds interesting... Do you have a set of VI's you could possibly post that would let me look at re-parenting functionality?
0 Kudos
Message 6 of 21
(4,701 Views)
Actually, it's surprisingly simple.
You can see a discussion about this, with some VIs, here. Those VIs are a real mess, but they show the basic idea.
If there are other VIs, which do handle all the windows names and error handling issues, I would like to hear about them as well, since I didn't touch this topic since that thread.

___________________
Try to take over the world!
0 Kudos
Message 7 of 21
(4,686 Views)
Actually I'd rather not distribute my vi's but instead ask NI to develop this functionality in a toolkit for labview 8 or whatever comes next. The other poster is correct that it is actually not that difficult. The trick is to activate and move the windows after you reparent them, which can all be done with a couple of windows API dll calls. Look on microsoft.com for the dlls.
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 8 of 21
(4,669 Views)
Oh what the heck, this will get you on the right track...
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 9 of 21
(4,668 Views)
Hey NI, this is what we want to be able to do through a toolkit you distribute. This is 100% labview. Notice you can drag windows around and look how they behave when you minimize, etc. This is vastly superior to subpanels, as you can reparent as many child windows as you want and debug their diagrams while they execute. You can also make the title bars invisible and move the windows to specified positions so they look like subpanels and can't be dragged. They can each even have their own run-time menus. This functionality is just plain awesome in large-scale projects. Yes, I have found that queues are the ideal way to communicate between these, I use a combo of queue's and FGV's. I cannot link more without permission of some of the other developers who worked on this.

Message Edited by billings11 on 05-16-2005 10:06 AM

-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 10 of 21
(4,662 Views)