Print Page | Close Window

CXTPReportControl and CFormView

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=2624
Printed Date: 26 April 2024 at 5:17pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPReportControl and CFormView
Posted By: tjohnson
Subject: CXTPReportControl and CFormView
Date Posted: 22 July 2005 at 11:05am

In an attempt to learn about the CXTPReportControl, I've been trying to use it as a control within a CFormView.  I've set up a Visual Studio project with the main view class being CFormView.  Then, using the resource editor, I've added a custom control to the form.  In the properties box, I assign "CXTPReportControl" to the class property and rename the control IDC_REPORT.  I then right click on the control and choose "Add variable ...".  In this dialog, I specify the CXTPReportControl again and choose XTToolkitPro.h/.cpp for the header/cpp files. 

I then code OnInitialUpdate as follows:

CFormView::OnInitialUpdate();

GetParentFrame()->RecalcLayout();

ResizeParentToFit();

reptCtrl.ModifyStyle(0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_TABSTOP);

reptCtrl.GetReportHeader()->AllowColumnRemove(FALSE);

reptCtrl.AddColumn(new CXTPReportColumn(0, _T("Column1"), 250));

reptCtrl.AddColumn(new CXTPReportColumn(1, _T("Column2"), 250));

CString str;

for (int i = 0; i < 1000; i++){

 CXTPReportRecord* pRecord = reptCtrl.AddRecord(new CXTPReportRecord());

 pRecord->AddItem(new CXTPReportRecordItemNumber(i, _T("Item %2.0f")));

 str.Format(_T("Item %i"), i);

 pRecord->AddItem(new CXTPReportRecordItemText(str));

}

reptCtrl.GetPaintManager()->m_columnStyle = xtpColumnFlat;

reptCtrl.Populate();

When I compile and run my project, I get a message box that says "Failed to create empty document" and the program exits. If I remove the CXTPReportControl from the form and replace it with any other control, the message box goes away and the program displays an empty form (well empty other than whatever control I put on it).

I've also experimented with just using a CDialog instead of CFormView (taking cues from the VirtualList example).  I get the same "empty document" message box. 

The only way I've been successful in using the CXTPReportControl is by using the CXTPReportView class.  I see from your samples, however, that I should be able to just embed the control itself on another form and get it to work.

What am I missing?



-------------
~Travis



Replies:
Posted By: tjohnson
Date Posted: 26 July 2005 at 8:58am
Just in case anyone else ever needs to know this, the solution was that I should have used the value "XTPReport" for the class property of the control.

-------------
~Travis


Posted By: yannick
Date Posted: 07 September 2005 at 7:55am

Hello,

 

I have the same problem, can you give me the solution?

Thank you!

 



Posted By: Oleg
Date Posted: 08 September 2005 at 3:59am
Write "XTPReport" for the class property of the control.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: yannick
Date Posted: 08 September 2005 at 4:30am

hi,

Yes I have already set this property.

My problem is that I cannot edit the Item like in the CodeJock Sample.

If I use this control with a CDialog, it work fine, I can edit and modify item.

But I need to use a CXTResizeFormView and with that one It's very difficult to edit the items....(I must click several times at the begening of the item text,if I click in the middle of the item area, I can't edit it...)

Do you know something about this problem?

Is Codejock Team can Help Me?

 

Thanks a lot



Posted By: Oleg
Date Posted: 08 September 2005 at 7:02am

http://forum.codejock.com/uploads/oleg/2005-09-08_070153_SimpleReport.zip - 2005-09-08_070153_SimpleReport.zip

I tried to reproduce problem, but without success. Try attached sample, do you see your problem with it?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: yannick
Date Posted: 08 September 2005 at 10:45am

Hello,

Thank you for you help!

But I have to search again, because I have different view chart:

I have the MainView (a CView).

The MainView have a CXTPTabControl, and each Tabs contain a CXTResizeFormView.

So I think there is a problem with the windows communications (Bad Messages Handling or a bad property or something like this....).

If you have time for make me a sample with this view chart it will be very nice.

I'am searching too about this problem.

Thank you very very much, and congratulation for the codejock team & products.

Regards.

mailto:yannick@nicolaudie.com - yannick@nicolaudie.com

http://www.nicolaudie.com - www.nicolaudie.com

 

 



Posted By: Oleg
Date Posted: 09 September 2005 at 5:36am

Hi,

ok, try to modify attached sample to make same chart and attach here, I will show what you must change.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: yannick
Date Posted: 09 September 2005 at 8:32am

Hello,

I have modified your sample, the prolem is that it's difficult to edit an item on the report control.

you can dowload it on :

http://ik180.ikexpress.com/~fred/dl/SimpleReport.zip

Thank you for your help.

Best Regards, Yannick.



Posted By: Oleg
Date Posted: 09 September 2005 at 1:37pm

Hi

As in TabbedView sample you must catch MouseActivate message and don't call base class.

Also I added some clipping styles to prevent flickers.

See Result:

http://forum.codejock.com/uploads/oleg/2005-09-09_133649_SimpleReport.zip - 2005-09-09_133649_SimpleReport.zip

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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