Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - CXTPCalendarDayView printing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPCalendarDayView printing

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


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Topic: CXTPCalendarDayView printing
    Posted: 18 August 2009 at 8:59am
Updated from Xtreme ToolkitPro v13.0.0
Printing of Day View worked wrong!
1. Print 2 pages - from 0:00 to 18:00 and from 10:00 to 18:00, i dont understand why? For what?? (You can see it at your CalendarDemoU.exe)
2. Wrong print if Scale Max Time == (DATE)1.0 (or 24:00)
I find at CalendarDemo that
AfxMessageBox(_T("MaxTime Hour should be > 0 and less 24"));

But it is wrong!!! MaxTime can be == 24:00! In previous versions all worked well!!!



How to fix it?????
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2009 at 9:08am
I cant override printing functions because all is private!!!
private:
BOOL m_bDayViewMode;
int m_nStartCell, m_nEndCell, m_nCurCell, m_nCellSteps; // internal cell's for printing loop
CUIntArray m_PageStart;

What should I do?
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2009 at 9:59am
That decision, I already have post:
void CXTPCalendarDayView::SetScaleMaxTime(const COleDateTime dtNewScaleMaxTime)
{
    if (dtNewScaleMaxTime.GetStatus() == COleDateTime::valid)
    {
        m_dtTimeScaleMax = dtNewScaleMaxTime;
        if ( m_dtTimeScaleMax.m_dt > 1.0 ) m_dtTimeScaleMax = CXTPCalendarUtils::ResetDate( m_dtTimeScaleMax );
        CXTPCalendarControl::CUpdateContext updateContext(m_pControl, xtpCalendarUpdateRedraw);
    }
}

or even better

AFX_INLINE const COleDateTime CXTPCalendarUtils::ResetDate(const COleDateTime& dtDateTime)
{
    if ( (double)dtDateTime <= 1.0 ) return dtDateTime;
    return (DATE)_ResetDate_dbl((double)dtDateTime);
}

Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2009 at 10:45pm
Not big deal - set 23:59:59 - so you can't see 24 tick - just line
 
You don't need to overwrite this
BOOL m_bDayViewMode;
int m_nStartCell, m_nEndCell, m_nCurCell, m_nCellSteps; // internal cell's for printing loop
CUIntArray m_PageStart;
They are absolutely internal.
 
Set your timescale interval to 10min and try to print
 
>>AfxMessageBox(_T("MaxTime Hour should be > 0 and less 24")); - this is part of Sample app - OptionsDialogBar.cpp - and never called because combo set as example to 0 - 23:30 range!
 
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 4:10am
I try your CalendarDemoStatic.rar it is work with bugs too. Scroll bars at print preview does not working at all - crash.
But the problem is not this now, You do not understand :(
Let me explain how it works your calendar
If you set Scale Min Time = 8:00 and set Scale Max Time = 9:00, then the calendar will show you:
---- <- 8:00
- 8 -
---- <- 9:00
Only 2 cells (if dimension of half hour)
If you set Scale Min Time = 8:00 and set Scale Max Time = 8:59, then the calendar will show you:
---- <- 8:00
- 8 - <- 8:30
Only 1 cell (if dimension of half hour)

What i want? I WANT TO SEE:
--- <- 23:00
- 23
---- <- 24:00
Yes! It is just line!!!! But if you set 23:59:59 you see only:


Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 4:49am
Vertical scroll bar working properly if page count properly calculated before scroll - compare
 
In contunue-print mode you can only use PageUp - PageDown to make one page step. After you reach last page - now your scrollbar will work propely
In MFC base class vertical scroll used only in Zoom-mode - it not suppose to move page in contunue-print mode
 
I f all your printing is 30 min scale interval with one page (13.0 and previous) - use

XTPCalendarControlView.cpp and XTPCalendarControlView.h from 13.0

 

btw - not сплиттер - scroller!

Where do you find "virtual" in this descriptor (XTPCalendarControlView.h) ?
 
private:

int m_nStartCell, m_nEndCell, m_nCurCell, m_nCellSteps; // internal cell's for printing loop

CUIntArray m_PageStart;

Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 5:29am
Report printing is work fine! Calendar printing does not work.
Please see video:
uploads/20090819_050700_Calendar.zip

Now i back to 13.0. Please pay attention to the my issues.
Maybe this will help with problem 24:00, found in the source
C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v13.0.0\Source\Calendar\XTPCalendarDayViewEvent.cpp

    if (CXTPCalendarUtils::IsZeroTime(dtEndTime) &&
        !CXTPCalendarUtils::IsEqual(dtStartTime, dtEndTime))
    {
        spEnd.SetDateTimeSpan(0, 0, 0, 1);
    }
    int nTopCell = XTP_SAFE_GET1(GetViewGroup(), GetDateTimeCell(dtStartTime, FALSE), 0);
    int nBottomCell = XTP_SAFE_GET1(GetViewGroup(), GetDateTimeCell(dtEndTime - spEnd, TRUE), 0);

    // is event's Begin/End on cells borders
    COleDateTime dtStartCellTime = GetViewGroup()->GetViewDay()->GetView()->GetCellTime(nTopCell);
    COleDateTime dtEndCellTime = GetViewGroup()->GetViewDay()->GetView()->GetCellTime(nBottomCell);
    dtEndCellTime += GetViewGroup()->GetViewDay()->GetView()->GetCellDuration();

    COleDateTime dtStart_TimeOnly = CXTPCalendarUtils::ResetDate(dtStartTime);
    COleDateTime dtEnd_TimeOnly = CXTPCalendarUtils::ResetDate(dtEndTime - spEnd);
    dtEnd_TimeOnly += spEnd;

or that
C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v13.0.0\Source\Calendar\XTPCalendarDayView.cpp

    COleDateTime stSTime = CXTPCalendarUtils::ResetDate(dtStart);
    COleDateTime stETime = CXTPCalendarUtils::ResetDate(dtEnd);

    if (CXTPCalendarUtils::IsZeroTime(stETime))
        stETime = CXTPCalendarUtils::SetTime_235959(stETime);

or that
C:\Program Files\Codejock Software\MFC\Xtreme ToolkitPro v13.0.0\Source\Calendar\XTPCalendarDayView.cpp

    BOOL bEndIsEnd = m_selectedBlock.dtEnd > m_selectedBlock.dtBegin;
    int nSelEndCell = GetCellNumber(CXTPCalendarUtils::ResetDate(m_selectedBlock.dtEnd -
        COleDateTimeSpan(0, 0, 0, bEndIsEnd ? 1 : 0)), bEndIsEnd);

and so on...
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 5:32am
Calendar printing functions is virtual, but i can not override them because its use private members:
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
virtual void _OnPrint2(CDC* pDC, CPrintInfo* pInfo, CRect rcPrint);

Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 5:37am
I see you movie - and I already explain you - use PgUp - PgDn if no Zoom used
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 5:43am
Originally posted by mdoubson mdoubson wrote:

I see you movie - and I already explain you - use PgUp - PgDn if no Zoom used

Ok.
But how I will explain it to my users? Please not click here because all crashed?
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 5:45am
I need to disable VScroll if Zoom not set. Promice
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 6:00am
ok, but if page count properly calculated VScroll is must be enabled.
For example i use in report

void CMyXTPReportView::OnBeginPrinting( CDC* pDC, CPrintInfo* pInfo )
{
    ASSERT(m_aPageStart.GetSize() == 0);
    m_aPageStart.RemoveAll();
    m_aPageStart.Add( 0 );
//    SetupStartCol( pDC, pInfo );

    int nCurPage = pInfo->m_nCurPage;
    pInfo->m_nCurPage = 65535;
    if ( PaginateTo( pDC, pInfo ) )
    {
        pInfo->SetMaxPage( (int)m_aPageStart.GetSize() - 1 );
    }
    pInfo->m_nCurPage = nCurPage;
}

If you add multipages to calendar print, please provide what would be done so with calendar, please add PaginateTo function.
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 6:56am
As you can see - it works because I use ForcePagination mode in Report case
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 6:58am
Originally posted by mdoubson mdoubson wrote:

As you can see - it works because I use ForcePagination mode in Report case

Yes, i see. Please add PaginateTo function to CalendarView.
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 7:24am
What about Scale Max Time == (DATE)1.0 (or 24:00) ???
I use m_dtTimeScaleMax = (DATE)1.0, because i want see all scale, if m_dtTimeScaleMax < (DATE)1.0 i does not see the last cell.
m_dtTimeScaleMax is public now, try to set it
m_dtTimeScaleMax = (DATE)1.0;
and than push print preview, and you can see what works wrong if print and/or if you exit print preview mode.
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 7:30am
As you can see in MFC source update - I tried your code without effect - now it commented. Find better way please
Let's better change TimeScale draw for last cell in this case (but in any cases we will never draw 24 as number - this is not logical - it still < restriction)
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 8:37am
Originally posted by mdoubson mdoubson wrote:

As you can see in MFC source update - I tried your code without effect - now it commented. Find better way please
Let's better change TimeScale draw for last cell in this case (but in any cases we will never draw 24 as number - this is not logical - it still < restriction)


Previously used without a twinge of conscience, and now will not? You understand that we will all work to alter the events?
The problem is that if you move an event at this time that he has not 19.08. 2009 23:30 - 19.08. 2009 23:59 and 19.08. 2009 23:30 - 20.08. 2009 00:00. Because you are so on the calendar was originally built - the lower limit and upper limit. Everything is working! Now you offer me to redo all of your new concept, right?
Neither have nowhere to draw the number 24! If you're worried about that in the options, for example, when printing, will be 23:00 and then 24:00, then 23:00 so do 00:00 (which actually would be 24:00, ie the beginning of the next day). My users do not care what is written 24:00.
The very scale of 24 we never see, as we see the number 18 will be selected if the range of 16 to 18. What is the problem then? Everything seems to work well, for everybody, and bang! Now, you guys will all work on another ...
Why do you print the other band displays? So on this I see only one explanation, the printing made by another person who does not understand how everything works.
The solution is simple (see code)
And when the press must take into account that m_dtTimeScaleMax may well be 1.0, in all the other code that takes into account (I showed the pieces of code above), it is not only the new features in the printing.
Put file XTPCalendarDayView.cpp, re build the library and you will see that everything works perfectly. void CXTPCalendarDayView::SetScaleMaxTime(const COleDateTime dtNewScaleMaxTime)
{
    if (dtNewScaleMaxTime.GetStatus() == COleDateTime::valid)
    {
        m_dtTimeScaleMax = dtNewScaleMaxTime;
        if ( m_dtTimeScaleMax.m_dt != 1.0 ) m_dtTimeScaleMax = CXTPCalendarUtils::ResetDate( m_dtTimeScaleMax );
        CXTPCalendarControl::CUpdateContext updateContext(m_pControl, xtpCalendarUpdateRedraw);
    }
}
Here is XTPCalendarDayView.cpp
uploads/20090819_083349_XTPCalendarDayV.zip
I am confused at your patches, so that the version calendar I use now:
uploads/20090819_083733_Calendar.zip
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 9:00am
What are you talking about - Previously used without a twinge of conscience? I tried it TODAY and after it not help and still give invalid data - COMMENTED IT. Old Printing Code was very functional-poor - supported only one page with very little detailes as use only one mode - 30min interval.
There is nothing in print code related to DayView modificaionts. Everybody who asked to have detailed DayView printout (multi-pages) happy.
 
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 9:02am
With my patch all works fine, but one thing
If i choose print range from 22:00 to 23:00, why it printed from 22:00 to 24:00 (23:59:59)? Hm... always adds one hour to the upper range  i dont understand. How print from 21:00 to 22:00?

Originally posted by mdoubson mdoubson wrote:

Btw - I like the fact our Forum site now supported cyrillic - how you print it - directly in Form?

Yes, directly in Form.
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 9:06am

I feel that "the more is the better"

Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 9:10am
Originally posted by mdoubson mdoubson wrote:

I tried it TODAY and after it not help and still give invalid data - COMMENTED IT.

Where it gives the wrong result? How can I repeat it?

Originally posted by mdoubson mdoubson wrote:


Old Printing Code was very functional-poor - supported only one page with very little detailes as use only one mode - 30min interval.
There is nothing in print code related to DayView modificaionts. Everybody who asked to have detailed DayView printout (multi-pages) happy.

I also want a multi-pages, but unfortunately this feature is not working correctly. Please, experiment with different intervals: in one case, prints two pages when you do not need, n another case, print one page when it needs to the two.
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 9:16am



Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 9:25am
I don't consider crazy cases somebody want to print 1 hour only -
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 10:53am
There is no problem to print 1 hour range (like this [22:30 - 23:30])- except [23-24] one:
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2009 at 1:56pm

Here fixed code covered 24:00 as feasible strict ( < )  ScaleMaxTime

https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar

 
As we are going to release 13.2 sometimes in September - please try to test and help to improve our Calendar
 
(all links already had 13.2 "beta" code - please try and give some feedback)
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.234 seconds.