LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI OpenGL control on child panel

We have a large CVI application simulating MDI child panels with CVI child panels. On one of these document panels we want to create an OpenGL control, but receive an error condition from OGLConvertCtrl: "The panel is a child panel". Anybody knows a workaround for this problem?
0 Kudos
Message 1 of 6
(4,343 Views)
HI,

Unfortunatelly the OpenGL functions will not allow you to create the control on a child panel. This is not clear on the documentation, but I'll file a correction request for that since it should be clear.

There are a couple of ways to get arround this, the first is to load the panel with no parent and them place it within the working are where the child panel resides. You may need to move this panels if the main panel is moved.

You can also use the Windows SDK function called SetParent() to confine a non-child panel within another panel. There is an example here that could help you.

Creating a Child Window Inside a LabWindows/CVI Top-level Panel to Simulate Multiple Document Interface (MDI) Applications

http://sine.ni.com/apps/we/niepd_web_display
.DISPLAY_EPD4?p_guid=B45EACE3DC9D56A4E034080020E74861&p_node=DZ52176&p_submitted=N&p_rank=&p_answer=&p_source=External

I hope this helps,
Regards,

Juan Carlos,
N.I.
0 Kudos
Message 2 of 6
(4,342 Views)
Thank you for answering my question.

I tried to follow your proposal. There are some problems:
a) The child window created by the API SetParent() changes position on CVI SetPanelSize() (i think a bug in CVI),
b) it remains on top of all other CVI child panels independent of focus.
c) it overlaps the CVI main panel menu and when you maximize it, it again covers the CVI main panel menu.

What i did to solve the problems:
a) requires a SetPanelPos() after each and every SetPanelSize(). That's ok.
b) Use the main panel / SetParent() trick for all former child panels. That's ok.
c) When you reduce the main panel client rectangle, the menu moves in, too. Looks like i will have to drop the CVI menu and replace it by a Win API menu to get things into order.
Now we have lots of menus...

I think i have to consider it impossible.
0 Kudos
Message 3 of 6
(4,346 Views)
I did it working on a hidden panel with OGL control and the copying the graphic results in a bitmap format (OGLCopyScaledCtrlBitmap) inside the visible parent panel.
0 Kudos
Message 4 of 6
(4,342 Views)
I have a similar problem to the one described here except that I am trying to use
the easy tab control as well as the OGL. When easy tab loads panels it only
accepts child panels and OGL only accepts parent panels. Using the SetParent
function does not affect how the OGLconvert or easytab load panel functions
sees the panels. ie. CVI functions still see them as they were originally loaded
using CVI functions even though through the windows api they appear differently
after SetParent is called. There is no ability to set panel attribute
ATTR_SYSTEM_WINDOW_HANDLE after SetPanel is called and hence you cannot
convert a CVI panel from child to parent or parent to child using the windows API.
It appears the only workable solution in this case is the pasting of image data.
Is there a fix for this in the latest CVI version or is this just an on going
stuff up.
0 Kudos
Message 5 of 6
(4,303 Views)
Hello frogman,

The fact that the OGL control is only available on parent panels is not necessarily a problem with CVI. Instead, it is simply a limitation of the OGL control. Likewise, a limitation of the easy tab control is that it takes in child panels. I would suggest copying the final image to the tab panel (as mentioned by PaoloB), or possible use a separate panel to display your 3D images.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 6 of 6
(4,275 Views)