LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dot NET container Relocating when Opening FP from Subpanel

Solved!
Go to solution

Greetings All,

 

In my application I wanted to load a VI that contains LabVIEW and Dot NET controls into a SubPanel and on clicking of a button(say pop out), I should remove it from the subpanel and open the front panel of the VI that was shown that was loaded into the subpanel. But when I do this the Dot NET containers gets relocated. I am not clear on why this is happening. Please give your suggestions on this behaviour and is there any way to fix this.

 

PS: I have attached images as well as the sample project explaining this behaviour

 

Thanks in Advance,

Sree.

0 Kudos
Message 1 of 4
(3,050 Views)
Solution
Accepted by topic author SreeRanjani

I've done a lot of work with .net containers and its not ONLY specific to subpanels.  I think the problems stem from the origin of panes and scrollbars and splitters can affect the offset of a .net object as well.  Couple ideas to help are to eliminate the scrollbars in the subpanel, if you are not showing them when it is inserted to the subpanel, to avoid scrollbar changes.

 

If that is not working for you, you be need to just programmatically set the position of the .net container in your subpanel, with an event or remotely with VI server once it gets attached to ensure it is in the right position.  Lot sof ways to fix it, unfortunately all are manual.

 

It can also help to position .net containers at 0,0 (the origin) so control the shift and positioning more easily.

Hope it helps you find a solution.

0 Kudos
Message 2 of 4
(3,031 Views)
Solution
Accepted by topic author SreeRanjani

A .NET control is actually drawn in a child window. My understanding is that when the control is in a subpanel, that window is a child of the the VI that contains the subpanel, presumably because the subpanel itself is drawn by LV and is not a child window. You can see this if you place objects in front of the subpanel and the .NET control will appear over them and if you look at panel leave events for the caller, which should fire when you go into the .NET control.

 

My guess is that when you move the VI to a new window, LV looks at the current position of the child window (which is relative to the containing VI) and mistakenly uses the same position in the new window, so the offset of the subpanel is added to it. Basically, sounds like a bug in LV.

 

As Mike suggests, I'm guessing that setting the position of the .NET container in code should help.


___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(3,016 Views)

Thanks a lot Mike and tst for your replies,they were very usefull

 

As mike suggested I am programmatically setting the position of the widgets, hence the issue is fixed.

 

I am able to observe what tst mentioned

 

 

"My guess is that when you move the VI to a new window, LV looks at the current position of the child window (which is relative to the containing VI) and mistakenly uses the same position in the new window, so the offset of the subpanel is added to it. Basically, sounds like a bug in LV."

 

 When I increase the distance of sub panel from the Top Left corner of the window in Caller.vi, the offset by which dot NET controls move when popping out also increases.

 

 

0 Kudos
Message 4 of 4
(3,003 Views)