Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Resize last column + printing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Resize last column + printing

 Post Reply Post Reply
Author
Message
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Topic: Resize last column + printing
    Posted: 25 March 2010 at 12:16pm
Hello,

I'm using the following simple function to resize only the last report control column:

void CMyReportView::InitColSizing()
{
    int nColumnsCount = GetReportCtrl().GetColumns()->GetCount(), nColumn;
    for (nColumn = 0; nColumn < nColumnsCount; nColumn++)
    {
        CXTPReportColumn* pColumn = GetReportCtrl().GetColumns()->GetAt(nColumn);
        if (pColumn && pColumn->IsResizable())
            pColumn->SetAutoSize(FALSE);
    }
   
    GetReportCtrl().GetColumns()->GetLastVisibleColumn()->SetAutoSize(TRUE);
}


Unfortunately, once I do this is seems to interfere with printing. Specifically, the last column stretches beyond the normal print border (this effect is also visible in print previews). Here's a screen shot of the problem:



If I don't adjust the column sizing, everything works as expected.

Anyone know how what I might be doing wrong here?


Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 02 April 2010 at 9:55am
Anyone else experiencing a similar problem? Seems like a bug to me, unless I'm just missing something.
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2010 at 1:37pm
First of all, what you are trying to do was implemented already. See SetAutoColumnSizing function here: http://forum.codejock.com/forum_posts.asp?TID=15075&KW=last
 
However, it never worked properly. So I'm still waiting for a fix, and I also believe I have pinpointed the bug you found:
"If you move your last column to the left, you get strange behavior when resizing."
 
Sure sounds like the same bug.
PokerMemento - http://www.pokermemento.com/
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2010 at 2:27pm
> First of all, what you are trying to do was implemented already. See SetAutoColumnSizing

I'm aware of this function, but it does not appear to be relevant to the problem I outlined. For example, if I distill my function down to two simple lines:

GetReportCtrl().GetReportHeader()->SetAutoColumnSizing(FALSE);
GetReportCtrl().GetColumns()->GetLastVisibleColumn()->SetAutoSize(TRUE);

It effectively does nothing at this point - no columns are resized (including the last one). it appears to be necessary to use a combination of SetAutoColumnSizing(TRUE), then turn off column sizing for all but last column.

But then when I do this, I have the printing problem that I outlined originally.

Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2010 at 2:37pm
BTW, it appears that in the v13.3.1 I can just call:

GetReportCtrl().GetReportHeader()->SetLastColumnExpand(TRUE, TRUE);

Which will implement an algorithm nearly identical to that in my original post.

But again, it still exhibits the printing problem that I outlined.
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2010 at 4:36pm
Sorry, that was the function I meant! And... it's buggy! I do believe the printing issue has to do with the drawing problems that appear when using this function.
 
Try creating a support ticket. Maybe CJ will notice...
PokerMemento - http://www.pokermemento.com/
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.