Author |
Topic  |
|
Alb
4 Posts |
Posted - 16 Apr 2008 : 20:57:10
|
Hi,
I'm using the GCL version 3.0 and VC 2005.
I copied the object structure from the pgwdemo example:
class CGraph : public QCGraphWnd
{
...
};
class CGraphPage : public QCPageWnd
{
...
CGraph* m_pGraph;
};
class CGraphCWnd : public CWnd
{
...
CGraphPage* m_pGraphPage;
};
As per the example, I create the graph page in the OnCreate of the graph CWnd. And I create the graph in the BuildPage of the graph page.
I would like the graph within the graph page to grow proportionally to the window, so I propagate the sizing message from the graph CWnd to the graph page where I call SetWindowPos as suggested by the documentation. I also create the graph page with the call:
WGCreatePage( "PAGE1", this, "Page 1", NULL, C_WHITE, PAGE_CLIENT, MM_PROPORT, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN );
But my graph does not size with the window (note that this is a contour plot if that has any bearing). I also noticed that the graph in the example pgwdemo does not size even though the graph page is created with MM_ISOTROPIC.
Thank you for the help, Al |
|
quinncurtis
1164 Posts |
Posted - 16 Apr 2008 : 23:06:40
|
Get rid of the last parameter in your WGCreatePage call. We used
WGCreatePage( "PAGE1", this, "Page 1", NULL, C_WHITE, PAGE_CLIENT, MM_PROPORT);
and it worked fine.
|
 |
|
Alb
4 Posts |
Posted - 19 Apr 2008 : 13:53:45
|
Thank you for the response.
I tried your suggestion, and it does allow for resizing in the demo program pgwdemo. However, the default style uses WS_POPUP which causes the page to launch in its own window. I would prefer it to launch as a child within its parent. Can this be done?
Also, in my actual application, this causes an assert failure at line 97 of pagewnd.cpp. The page description is returning NULL. The only difference I can find between my app and the test program is that my app is using the charting tools in a DLL. From the documentation, I got the impression that QC was built to work with user DLLs, but I'm not sure. Could this in anyway be causing the assert?
I'll continue to investigate the assert, and see if I can reproduce it in a smaller sandbox app.
Thank you, - Al |
 |
|
quinncurtis
1164 Posts |
Posted - 19 Apr 2008 : 19:47:56
|
OK, we went back and used: WGCreatePage( "PAGE1", this, "Page 1", NULL, C_WHITE, PAGE_CLIENT, MM_PROPORT, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN );
It is the responsibility of the parent window to resize all child windows. So you would need to add an OnSize message processing routine to the parent, CMainWindow in the Pgwdemo example. In the OnSize method you would explicitly set the size of the page windows using the Windows SetWindowPos method.
void CMainWindow::OnSize ( UINT nType, int cx, int cy )
{
if (pPage1 != NULL)
{
pPage1->SetWindowPos(NULL,0,0, cx,cy, 0);
}
}
You must also add OnSize definitions to the afx_msg section of the CMainWindow prototype in the Pgwdemo.h, and the CMainWindow message map in Pgwdemo.cpp
It sounds like you may have confused the graph windows with the parent window of the page window.
The GCL for MFC was NOT designed to be called from other DLLs. Every one of our examples has the GCL libraries called from the main program. It may be possible, we just don't have any experience in that area. We do know that is critical that you keep 100% the calls to our libraries from a single DLL, and don't also call them from some other DLL or the main program. That sets up different competing instance threads and will not work. |
 |
|
Alb
4 Posts |
Posted - 20 Apr 2008 : 21:10:45
|
Thank you for catching the frame window OnSize. I can't believe I missed that. I added OnSize to the main window and it works fine. Also, thanks for the heads up on the user DLL.
- Al |
 |
|
|
Topic  |
|
|
|