LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Child windows inside child windows. (Grandchildren?)

Hi all. I'm sorry to have to ask a question about how to work with child windows since the topic seems to have been discussed at length and most people are probably getting tired of it, but...
I have attempted to write a program that allows me to display images as child windows BUT limits where inside the main front panel they can be dragged to. I have done this by using a sub-vi as a child inside the main window and having its properties set such that you can't tell it is another window (no title bar, etc). Then, I attempted to display images as children in that sub-vi window. The effect is that it appears that the image is a child in the main window (actually in sub-vi window) but it cannot be dragged outside a particular region in the main panel. I hope that makes sense (I attached my code so you can see). This seems to work just fine except that I can't seem to get it to allow me to make more than one image a child window of the sub-vi panel (I suppose that would make it a grandchild?). I can make more than one image a child of the main panel with exactly the method I have used, but it doesn't seem to work for the sub-vi panel.
I have used a couple "make child" examples I found in the discussion forum for this task. I have to admit to not really understanding how they work, which may be why I can't get this to work. I had to use a different make child example for the sub-vi than the one I used for the images and I don't understand the difference. Finally, I don't understand why sometimes the references are opened and then closed, and sometimes they are not closed. I don't know if this is an oversight or intentional. Note, the code I am sending is a modification of what I found on the forum to try to get my particular task to work.
The questions about the difference between the "make child" and "make IMAQ child" examples and the thing about the references are secondary. I suppose I don't really need to understand that if someone could just help me to get more than one image displayed as a child in the sub-vi window.
I'm sorry for the long winded explanation. I am just trying to ensure that what I tried to do, what I want to do, and what I don't understand, are clear. Thank you for your time.
0 Kudos
Message 1 of 8
(4,590 Views)
CJS,
I've included your code, now fixed to do what you want (I think). Basically you had all the code you needed, just had to reorder it.

LabView doesn't have a built in way of doing this type of child and grandchild work, (although I hope they will work on it) so you will be dealing with the Windows API set, which you will be able to find most of the documentation for on msdn.microsoft.com. If you want to find out more about the functions you are using search for them on that web site and see what you are doing in the Windows API world.

Thanks for the opportunity to solve this problem, I hadn't tried this configuration of windows before, and it might prove useful in the future.

I didn't take the time to answer your references
question, but in general sll LabView references need to be closed.


Chris Davis
Message 2 of 8
(4,584 Views)
Thank you for your solution, it seems to work just fine. I was hoping you could explain for me the problem with the order of operations. You rearranged the order to:

1. Display two IMAQ windows
2. Make the two IMAQ windows into children of child.vi
3. Make child.vi into child of main.vi

And then it worked. What I am wondering then is why does making the image windows into children BEFORE there is something in the image (like I had tried to do) work just fine if you make them children of the main window. It only failed when I tried to make them children of the sub-vi. Also, the order I had:

1. make sub-vi child of main
2. make image windows children of sub-vi
3. display images

Works fine in the case of only creating ONE image as a child
of the sub-vi. When you run my code, the first image does what I want it to, and the error occurs when it tries to do the same thing with the second.
I really hope someone can answer this for me because my application requires that the user be able to add more images or remove them at will from the sub-vi and the order you laid out for me (though it works perfectly) doesn't seem to support this. It would seem that the number of windows and their corresponding images have to be defined at the time of execution.
Forgive me if this is a simple matter, I still don't really know what I am doing. Hopefully we can work this into an elegant solution. I've noticed I'm not the only person who has asked if this kind of affect can be done, but no one (so far as I have seen) has offered up a solution.
Thank you for your time.
0 Kudos
Message 3 of 8
(4,584 Views)
Hi
I want to use Make Imaq Child.vi but am getting an error 6002.  I think it's because I don't have users32.dll.  Where can I get it?
Thanks.
0 Kudos
Message 4 of 8
(4,404 Views)
user32.dll comes with MS Windows.  As long as you got Windows installed, you should have it.  It's under c:\windows\system32\
 
George Zou
George Zou
0 Kudos
Message 5 of 8
(4,390 Views)
Hi all, I tried to run the code but it ask me for some IMAQ subvis. How can I get these vis, thanks.
0 Kudos
Message 6 of 8
(4,382 Views)

If you don't have IMAQ, you can try the direct windows approach:

http://forums.ni.com/ni/board/message?board.id=170&message.id=130309

http://forums.ni.com/ni/board/message?board.id=170&message.id=121700


___________________
Try to take over the world!
0 Kudos
Message 7 of 8
(4,377 Views)

Additionally, NI IMAQ is also a free download on our website, found with all of the other Current Vision Software  Note that some of the downloads on this page are actually updates for other Vision applications.  You would be most interested in NI IMAQ version 3.1.3.

Robert

0 Kudos
Message 8 of 8
(4,352 Views)