About TCalendar
Posted: Mon Dec 07, 2020 10:07 am
Hello, In our program we ask for a range di date, using 2 DatePicker, I would like change it using the Month Calendar Control
that is supported by FiveWin by the TCalendar class.
What I saw, trying the testcal sample is the some animations are missing, I fixed it adding these pieces of code on the sample (and on every use)
and
another way is overriding HandleEvent in TCalendar, of course.
Here a couple of video with the missing animations :https://imgur.com/a/vA0lNfn
Another piece that is missing is the query for size of the control, that I would implement in this way:
From MSDN:
MonthCal_GetMinReqRect
Retrieves the minimum size required to display a full month in a month calendar control. Size information is presented in the form of a RECT structure.
MonthCal_SizeRectToMin
Calculates how many calendars will fit in the given rectangle, and then returns the minimum size that a rectangle needs to be to fit that number of calendars.
that is supported by FiveWin by the TCalendar class.
What I saw, trying the testcal sample is the some animations are missing, I fixed it adding these pieces of code on the sample (and on every use)
Code: Select all
// my fix
__objDelMethod(oCal, "HandleEvent" )
__objAddMethod(oCal, "HandleEvent", @simplyNil())
__objDelMethod(oCal2, "HandleEvent" )
__objAddMethod(oCal2, "HandleEvent", @simplyNil())
// *** ***
Code: Select all
static function simplyNil()
return nil
Here a couple of video with the missing animations :https://imgur.com/a/vA0lNfn
Another piece that is missing is the query for size of the control, that I would implement in this way:
Code: Select all
//----------------------------------------------------------------------------//
HB_FUNC( MONTHCAL_GETMINREQRECT ) // hWnd --> { nTop, nLeft, nBottom, nRight }
{
HWND hWnd = ( HWND ) fw_parH( 1 );
RECT rct;
rct.top = 0;
rct.left = 0;
rct.bottom = 0;
rct.right = 0;
if( hWnd )
MonthCal_GetMinReqRect( hWnd, &rct );
hb_reta( 4 );
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.left, -1, 2 );
hb_storvni( rct.bottom, -1, 3 );
hb_storvni( rct.right, -1, 4 );
}
//----------------------------------------------------------------------------//
HB_FUNC( MONTHCAL_SIZERECTTOMIN ) // hWnd,{ nTop, nLeft, nBottom, nRight } --> { nTop, nLeft, nBottom, nRight }
{
HWND hWnd = ( HWND ) fw_parH( 1 );
RECT rct;
rct.top = hb_parvni( 2, 1 );
rct.left = hb_parvni( 2, 2 );
rct.bottom = hb_parvni( 2, 3 );
rct.right = hb_parvni( 2, 4 );
if( hWnd )
MonthCal_SizeRectToMin( hWnd, &rct );
hb_reta( 4 );
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.left, -1, 2 );
hb_storvni( rct.bottom, -1, 3 );
hb_storvni( rct.right, -1, 4 );
}
//----------------------------------------------------------------------------//
MonthCal_GetMinReqRect
Retrieves the minimum size required to display a full month in a month calendar control. Size information is presented in the form of a RECT structure.
MonthCal_SizeRectToMin
Calculates how many calendars will fit in the given rectangle, and then returns the minimum size that a rectangle needs to be to fit that number of calendars.