Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Display a ReportControl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Display a ReportControl

 Post Reply Post Reply
Author
Message
baerten View Drop Down
Newbie
Newbie
Avatar

Joined: 28 September 2006
Location: Germany
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote baerten Quote  Post ReplyReply Direct Link To This Post Topic: Display a ReportControl
    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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
baerten View Drop Down
Newbie
Newbie
Avatar

Joined: 28 September 2006
Location: Germany
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote baerten Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
  
--
WBR,
Serge
Back to Top
baerten View Drop Down
Newbie
Newbie
Avatar

Joined: 28 September 2006
Location: Germany
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote baerten Quote  Post ReplyReply Direct Link To This Post 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 !
Back to Top
manoj View Drop Down
Newbie
Newbie
Avatar

Joined: 26 October 2004
Location: India
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote manoj Quote  Post ReplyReply Direct Link To This Post 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)

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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.