LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

moving two panels simultaneously

I am trying to "dock" (attach) one panel to another. When Panel2 is moved alongside Panel1, it is placed in a way that it exactly lines up with Panel1. So far so good. But now, when I move Panel1, Panel2 remains where it is. I resolve this by moving Panel2 alongside Panel1 again as soon as an EVENT_PANEL_MOVE is received.

However, this results in Panel1 being moved and Panel2 jumping to it as soon as the moving is completed. Though effective, it looks a bit odd and I would prefer Panel2 to stay alongside Panel1 as it is being moved. Is there a way to do this, because the EVENT_PANEL_MOVE is only generated after the moving is completed.

Extended mouse events comes to mind, to track the dragging of the mouse, but how can I know whether or not a panel is attached to the mouse when it is being dragged?

Regards,

Erwin Timmerman
0 Kudos
Message 1 of 4
(3,220 Views)
Hey Erwin,
I guess you wouldn't be interested in making the second panel a child of the first one? Just an idea. Not sure if the two panels really need to be separated.

Orlan
0 Kudos
Message 2 of 4
(3,205 Views)
Cosmo, thanks for the idea. But as far as I understand it a child panel cannot be moved away from its parent panel. My application has just 2 panels (see the image below), and I would like them to be able to be placed just like the user wants it. Docked, separated, whatever seems appropriate. When I would place them in a parent panel and they wouldn't be the same height, would the unused part of the parent rectangle still cover the screen?

0 Kudos
Message 3 of 4
(3,182 Views)
Hey Erwin,
Yes, you're right. The child will remain 'inside' of the parent. If you let the user drag a child window within the parent, then any part that 'should' display outside of the parent frame will be clipped. I guess I was interpreting what you were asking for another way.

If only a separated panel is desired, then you already have what you need. If the user says, no, I want it docked now instead of separated, then you close the 'legend', LoadPanel() the legend as a child, widen the graph (parent) enough to hold the legend, and then display the child legend on say the right side of the graph as not moveable. Now it will go with the window when it is dragged and draw as you requested.
Of course, if you want to be able to put the legend on the left and the graph on the right, just as easily as vice-versa, then perhaps it would be better to have the graph as a child as well, so that you can move the whole blocks around each other in only a few function calls. Essentially this makes CVI run like a multiple document interface (MDI).
Just like what you show below, the child legend would still have the scroll bar so you could ensure that it doesn't extend below the graph. If they say, great, now I don't want any legend at all, you must narrow the graph window but you decide whether to leave the legend in memory or to ditch it. Not sure if you like these approaches. They work pretty well for me sometimes.

Good luck,
Orlan
0 Kudos
Message 4 of 4
(3,175 Views)