Here is the code that works perfectly in xHarbour to build the calendar:
- Code: Select all Expand view
METHOD BuildCalex() CLASS MpCal
local oErr
TRY
::oCalex := tActiveX():New( ::oPanelCalex, "Codejock.CalendarControl.15.0.1" )
CATCH oErr
MsgStop( "Missing installation Components", "Aborting" )
Quit
END
with object ::oCalex
:VisualTheme = ( xtpCalendarThemeOffice2007 )
:bOnEvent = { | event, aParms | ::xTrmCalTriggeredEvents( Event, aParms ) }
:SetDataProvider( "Provider=custom" )
:DataProvider:open()
:ShowCaptionBar = ( .f. )
:ShowCaptionBarSwitchViewButtons = ( .f. ) //turn off switch from day, week, month view on capbar
:ViewType = ( xtpCalendarDayView )
:EnableToolTips(.t.)
:DayView:TimeScaleMinTime = ( [7:00:00 AM] )
:DayView:TimeScaleMaxTime = ( [7:00:00 PM] )
:DayView:TimeScale = ( 15 )
:Options:WorkDayStartTime = ( [7:00:00 AM] )
:DayView:ScrollToWorkDayBegin() //scroll the view to the work day starting time
:Options:DayViewTimeScaleShowMinutes = ( .t. )
:EnableReminders( .t. )
:RemindersUpdatePeriod = ( [12:10:00 AM] ) // Sample has #12:10:00 AM# Call is as Date
end
::oPanelCalex:oClient = ::oCalex
Return Nil
//---------------------------------------------------//
METHOD BuildDatePicker() CLASS MpCal
local nTmp
local oPanel, oErr, oWnd
TRY
::oDtPick := tActiveX():New( ::oPanelExplorer,"Codejock.DatePicker.15.0.1" )
With Object ::oDtPick
:Enabled = ( .t. )
:ShowWeekNumbers = ( .t. )
:VisualTheme = ( xtpCalendarThemeOffice2007 )
:AttachToCalendar( TOleAuto():New( ActXPDisp( ::oCalex:hActiveX ) ) )
End
::oPanelExplorer:oClient := ::oDtPick
CATCH oErr
END
RETURN nil
//---------------------------------------------------//
METHOD BuildStdDialogs() CLASS MpCal
local oErr
TRY
::oCalexStdDlgs := CreateObject( "Codejock.CalendarDialogs.15.0.1" )
::oCalexStdDlgs:Calendar( TOleAuto():New( ActXPDisp( ::oCalex:hActiveX ) ) )
::oCalexStdDlgs:RemindersWindowShowInTaskBar = .t.
::oCalexStdDlgs:CreateRemindersWindow()
CATCH oErr
MsgInfo( "Missing standard dialogs components" )
END
RETURN
//---------------------------------------------------//
METHOD BuildPanels() CLASS MpCal
local oBrush
local nHeight := ::oCwnd:nHeight
::oPanelCalex = TPanel():New( 0, 175, ( nHeight ), ::oCwnd:nWidth, ::oCwnd:oWndClient )
::oPanelExplorer = TPanel():New( 0, 0, ( nHeight ) , ::oPanelCalex:nLeft, ::oCwnd:oWndClient )
RETURN nil
In my transition to using Harbour with MSVC 2010, trying to activate the control ended up in a GPF ( no error message ). You will note that in the BuildDatePicker( ) method, and BuildStdDialogs( ) method, there is a use of ActXPDisp( ). Antonio suggested that the return was not correct, and he built an alternative ActXPDispPtr( ). Using that with the BuildDatePicker( ) method allowed the calendar to display, however when using substituting it in BuildStdDialogs( ), it has an error. The screen will display, but the selection of dates and views will not work.
Normally, just like Outlook, the left column shows several months of date picker controls. The right panel shows the schedule for the day. The right column works, and allows for the entry of appointments. However, the left column does not, and thus you can't change dates, or display type ( day, week, month ).
Does anyone have a suggerstion ? This is literally the last obstacle I have in moving from xHarbour ( 2010 ) to current Harbour.
Thanks.
TIm