Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - CXTPReportControl and CFormView
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPReportControl and CFormView

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

Joined: 20 July 2005
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote tjohnson Quote  Post ReplyReply Direct Link To This Post Topic: CXTPReportControl and CFormView
    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
Back to Top
tjohnson View Drop Down
Newbie
Newbie
Avatar

Joined: 20 July 2005
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote tjohnson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
yannick View Drop Down
Newbie
Newbie


Joined: 07 September 2005
Location: France
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote yannick Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2005 at 7:55am

Hello,

 

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

Thank you!

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2005 at 3:59am
Write "XTPReport" for the class property of the control.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
yannick View Drop Down
Newbie
Newbie


Joined: 07 September 2005
Location: France
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote yannick Quote  Post ReplyReply Direct Link To This Post 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



Edited by yannick
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2005 at 7:02am

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
Back to Top
yannick View Drop Down
Newbie
Newbie


Joined: 07 September 2005
Location: France
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote yannick Quote  Post ReplyReply Direct Link To This Post 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.

yannick@nicolaudie.com

www.nicolaudie.com

 

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
yannick View Drop Down
Newbie
Newbie


Joined: 07 September 2005
Location: France
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote yannick Quote  Post ReplyReply Direct Link To This Post 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.



Edited by yannick
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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:

2005-09-09_133649_SimpleReport.zip

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.203 seconds.