Display a ReportControl |
Post Reply |
Author | |
baerten
Newbie Joined: 28 September 2006 Location: Germany Status: Offline Points: 10 |
Post Options
Thanks(0)
Posted: 04 October 2006 at 3:34am |
Hello,
i'm new at the MFC-World. I made a MDI-Application and added a new DocTemplate to the applic : pDocTemplate = new CMultiDocTemplate(IDR_Search, RUNTIME_CLASS(FSearchDoc), RUNTIME_CLASS(FSearch), // custom MDI child frame RUNTIME_CLASS(FSearchView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); The View is related to a Dialog ( : CFormView(FSearchView::IDD) ) it works nice with the Office2007Frame-Style Now i insertet a custom control on the Dialog and entered the classname "XTPReport" Then i create the member to the View of type "CXTPReportControl Grid;" and related the member to the Ressource : DDX_Control(pDX, ID_GRID, Grid); At the "OnCreate" i add the columns to the grid and some sample records. all executes without errors, but i dont see the grid in the window ( when it runs ) Big thanks |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
Firstly, please check whether the window is visible Try calling Grid.ShowWindow(SW_SHOW); Also, quite often a similar problem is caused because by default "XTPReport" window class is registered in context of Application instance handle (AfxGetInstanceHandle() is called). To resolve it, you have to call RegisterWindowClass() in context of your dll resource(instance) handle. Example:
-- WBR, Serge |
|
baerten
Newbie Joined: 28 September 2006 Location: Germany Status: Offline Points: 10 |
Post Options
Thanks(0)
|
I don't have a AfxGetInstanceHandle() in my source code
Grid.ShowWindow(SW_SHOW); doesn't work, it produces an error in winocc.cpp Other components on the form are showed correctly Does the ReportControl Grid work with CFormView ? Big Thanks |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
AfxGetInstanceHandle is a global MFC function. Please see MSDN help on it.
Report control is a window and it works together with other windows. It works with CFormView as well. Did you try to insert those 2 lines to your FormView class constructor? HINSTANCE hRCthisDLL = AfxFindResourceHandle(MAKEINTRESOURCE(IDD), RT_DIALOG); Grid.RegisterWindowClass(hRCthisDLL); Did you try to go inside FormView creation in the debugger to understand where is a problem? If sill no, try it. Does some errors appear during formView window creation? Also, you can use CXTPReportControl::Create() method to create control. To help you with understnading, I've just created a simple sample. Exract it and put to folder: ToolkitPro\Samples\ReportControl uploads/20061006_043431_RepCtrlOnCFormV.zip -- WBR, Serge |
|
baerten
Newbie Joined: 28 September 2006 Location: Germany Status: Offline Points: 10 |
Post Options
Thanks(0)
|
Big thanks for the Sample
I had no errors during creation of the ReportControl So i placed the "Creation Code" in the OnInitialUpdate() of my CFormView and all works nicely Before i had the code in the OnCreate() Method I startet in MFFC since 2 weeks. Before i made it all with .NET Forms. So, the changings between MFC and "click-click-click-it works" .NET are still enormously Thanks for your great support ! |
|
manoj
Newbie Joined: 26 October 2004 Location: India Status: Offline Points: 31 |
Post Options
Thanks(0)
|
Hi Serge, I tried your given sample but same error occured here also (my post http://forum.codejock.com/forum_posts.asp?TID=8421) CRepCtrlOnCFormViewView::CRepCtrlOnCFormViewView() : CFormView(CRepCtrlOnCFormViewView::IDD) { //{{AFX_DATA_INIT(CRepCtrlOnCFormViewView) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT // TODO: add construction code here}
I attached a call stack of given sample uploads/20071015_011416_callstack.zip Kind Regards Manoj Jangid |
|
===========================
मनोज कुमार जांगिड Systweak Software Pvt. Ltd. मो: +919829273011 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |