LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any child window in this point?

Hi,
i have program with number of childs and grandchilds windows. I want that if i move grandchild window out of parent window, it will change its parent to window that it found above it.
So i get callback EVENT_PANEL_MOVE and check if top and left coordinates are out of parent window region. If yes, i discard it and load with new parent, but now is my problem:
How can i know what window now is parent?
0 Kudos
Message 1 of 6
(3,509 Views)
Sir,
I am confused with your question. Are you asking what panel will be the parent after parent panel is resized in order to "fit" the child panel within? I'm unable to envision your issue. Let me know....

Daniel McChane
Application Engineer
National Instruments
0 Kudos
Message 2 of 6
(3,509 Views)
I'm sorry I don't understand your application. If you want to assign a new parent by moving a grandchild, why have it as a grandchild to begin with? Why not have it as a child of your main panel? Why do you need to reassign its parent?
Message 3 of 6
(3,509 Views)
There is example "Panels" that shipped with CVI. It explains how create child windows. I'm trying to modify it. I attached bmp file that explains what i want to do exactly.

Thanks.
0 Kudos
Message 4 of 6
(3,509 Views)
Please, look my comment to another answer of my question.
0 Kudos
Message 5 of 6
(3,509 Views)
There are some drawbacks to discarding and reloading the grandchildren:
1. The panel callback checking EVENT_PANEL_MOVE won't run until you stop moving the panel. The callback waits until you release the mouse button to process the event. So you can't move a child out of its parent (by assigning a new parent) unless you release the mouse.
2. The panels will lose focus and may blink as you discard and reload. The movement won't appear smooth.
3. The panels will revert to their default positions from the UIR file. You'll need to read the panels position before discarding using GetPanelAttribute then restore its position after reloading.

Why is it important to assign a new parent to the grandchild? Does its behavior change based on who the parent
is? If so, how? Why not load the panels as children of the main panel? Then you could move them anywhere you want without assigning parents.

To know if a panel you moved is on top of another panel, you need to use GetPanelAttribute to read the top, height, left, and width of all the panels. Then do some simple math to determine if the top left of the moved panel is within another panel (top to top + height, left to left + width). Like in drawback 1 above, you won't know where the moved panel is until you stop moving it and release the mouse button. You could get updated into on the mouse position using ExtendedMouseEvents as the panel is moving, but to identify the panel position based on the mouse position, you need to know where on the panel title bar the mouse was first clicked.
0 Kudos
Message 6 of 6
(3,509 Views)