LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Child panel in parent panel- strange top value

Hi!

I want to write application where I have menu with buttons. Depending on the button pressed the buttons should hide and another design bring on front.

I don't have any ideas except make that on different panels. I made one parent panel, and a few child panels. When I click button the panel with buttons hides and I'm displaing another panel with width and height equal to parent panel. I can't understand why I have to always have value equal to 30 in top property of child panel. Left property is set o zero and it's displaing OK. When I set 0 to top property the child panel is partially hidden in parent window.

Why the top property have to be always set to 30 to display exactly panel in panel? I tried to switch on and off titlebar, but it seems taht is no problem. Anyone can explain me that behaviour? Maybe any other ideas to make that kind of application? I don't want to use tabs.

0 Kudos
Message 1 of 9
(4,340 Views)

Hi,

 

just a few ideas, may be one may be helpful:

 

- You can also show and hide controls on the same panel, although this will be tedious to design in the UI editor if they overlap.

- You can also use regular panels, load them, and display or hide them on request - you don't need to use child panels.

- My suggestion (didn't try it) for the position 30 is that you have the title bar of the parent panel (child panels are within its parent panel)

- I didn't fully understand the menu with buttons?

 

Wolfgang

0 Kudos
Message 2 of 9
(4,339 Views)

A few questions first to help me out with this issue:

 

What version of CVI are you using?

 

How are you setting the "value equal to 30 in top property of child panel?" Are you setting it in the Property Browser, by using SetPanelAttribute(childHandle, ATTR_TOP, 30) or maybe a call to SetPanelPos()?

 

Is the child panel set to Auto Center Horizontally & Vertically when loaded?

 

 

It might also help us debug this issue if you attached the .UIR file you're using here.

Kevin B.
0 Kudos
Message 3 of 9
(4,334 Views)

Hi!

LabWindows/CVI2010

I set it in Property Browser.

It's not a problem of titlebar. I have to always set it to 30 to dispaly whole panel in parent window.

You can run userint/panels.cws from sample programs to check it. Try to dispaly child panel1 in parent panel from point left-0,top-0 and try change top property to 30.

0 Kudos
Message 4 of 9
(4,322 Views)

I'm attaching some pictures so that there's no confusion over what I'm talking about. I'm using the userint/panels.cws, but I modified childPanel1 to be the exact height of the parent panel as you can see in this picture taken from the UI Editor:

Child Panel in UIR.png

 

If I don't programmatically set the top of the panel and auto-center vertically is not set to true, then I get this when the panel is loaded. You can see that the panel is being cut off because it loads inside the parent panel using the top value set in the UIEditor.

Child panel top not explicitly set.png

 

If I set the child panel to auto-center vertically it looks like this. You can see that the child panel's title bar is partially obscured due to the auto-centering, and the splitter at the bottom of the child panel is not visible.

Child Panel set to Auto center vertically.png

 

If I then programmatically set the top and left to (0,0) I get this. The frame of the child panel (including the title bar) is hidden, but you can see that everything on the panel is visible:

Child Panel top set to 0.png

 

If I programmatically set the top to 30 it looks like this. The title bar is visible but you can see that the control at the bottom of the panel is now no longer visible:

Child Panel top set to 30.png

 

I'm assuming that you're seeing the behavior in the 4th screen shot when you set the top to 0 and something similar to the 5th screen shot when you set the child panel top to 30. I'm guessing that due to the font being used on your machine, the thickness of the child panel title bar is actually 30 so it doesn't stand out quite as much as mine.

 

When setting the position of a panel inside another panel, the frame (which includes the titlebar) is ignored, so that (0,0) cooresponds to the very first pixel that is actually visible in the panel. I'm guessing that what you want to do is either:

A) Disable the titlebar in the child panel and set the frame thickness to 0, or

B) If you need the titlebar of the child panel to visible, change the height of the of the child panel to be = (height of parent panel - 30).

Kevin B.
0 Kudos
Message 5 of 9
(4,318 Views)

Well yes. It's all good when i set the top property programically. Why it's not working when I define top property as 0 in UIEditor? I set it before run program to 0 but it seems it's ignored by program.

0 Kudos
Message 6 of 9
(4,308 Views)

Which one of those screenshots does it most closely resemble when  you set the top to 0? Is the child panel set to auto-center vertically (on load)? I'm not sure what kind of behavior you're seeing.

Kevin B.
0 Kudos
Message 7 of 9
(4,294 Views)

Auto center horizontally only. The child panel is to high. When I set 30 in UI or set top property to 0 programically- it's OK.

0 Kudos
Message 8 of 9
(4,287 Views)

I'm a little confused as to what behavior you're seeing currently. It would be helpful if you could either attach your UIR (if its got proprietary information on it you could delete all the contents of the two panels) or at least attach a screenshot so that I could see what is going wrong. Thanks.

Kevin B.
0 Kudos
Message 9 of 9
(4,268 Views)