Print Page | Close Window

Display a ReportControl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=5211
Printed Date: 21 November 2024 at 11:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Display a ReportControl
Posted By: baerten
Subject: Display a ReportControl
Date 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



Replies:
Posted By: sserge
Date Posted: 04 October 2006 at 8:27am
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:

CTestDlgRepCtrl::CTestDlgRepCtrl(CWnd* pParent /*=NULL*/)
         : CDialog(CTestDlgRepCtrl::IDD, pParent)
{  
    HINSTANCE hRCthisDLL = AfxFindResourceHandle(MAKEINTRESOURCE(IDD), RT_DIALOG);
    m_wndReport.RegisterWindowClass(hRCthisDLL);
}


--
WBR,
Serge


Posted By: baerten
Date Posted: 05 October 2006 at 4:07am
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


Posted By: sserge
Date Posted: 06 October 2006 at 4:34am
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 - uploads/20061006_043431_RepCtrlOnCFormV.zip
  
--
WBR,
Serge


Posted By: baerten
Date Posted: 06 October 2006 at 5:05am
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 !


Posted By: manoj
Date Posted: 15 October 2007 at 1:15am

Hi Serge,

I tried your given sample but same error occured here also (my post http://forum.codejock.com/forum_posts.asp?TID=8421 - 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

http://forum.codejock.com/uploads/20071015_011416_callstack.zip - uploads/20071015_011416_callstack.zip
 
 
Kind Regards
 
 
Manoj Jangid


-------------
===========================
मनोज कुमार जांगिड
Systweak Software Pvt. Ltd.
मो: +919829273011



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net