Dear all,
If allowed.. please post here schedule.prg from FWH12.06.. I need to try codejock FWH sample..
I have FWH12.05 which unfortunately not included the schedule.prg..
Thanks!
#INCLUDE "fivewin.ch" //
#INCLUDE "hbcompat.ch"
#DEFINE HELP_FINDER
#DEFINE HKEY_LOCAL_MACHINE 2147483650
static cAlias
function Main( nMode )
LOCAL oWnd, oBar
REQUEST DBFCDX
rddRegister( "DBFCDX", 1 )
rddsetdefault( "DBFCDX" )
// SET options
SET _3DLOOK ON
SET DELETED ON
SET EPOCH TO 1950
SET CENTURY OFF
SET EXCLUSIVE OFF
SET DATE TO AMERICAN
MpCal():New()
RETURN NIL
//---------- theme constants
#define xtpCalendarThemeOffice2000 0
#define xtpCalendarThemeOfficeXP 1
#define xtpCalendarThemeOffice2003 2
#define xtpCalendarThemeOffice2007 3
//----------- views
#define xtpCalendarDayView 0
#define xtpCalendarWorkWeekView 1
#define xtpCalendarWeekView 2
#define xtpCalendarMonthView 3
// #define xtpCalendarTimeLineView 4
#define xtpCalendarEO_Unknown 0 //Unknown operation value.
#define xtpCalendarEO_DragCopy 1 //Drag copy event.
#define xtpCalendarEO_DragMove 2 //Drag move event.
#define xtpCalendarEO_DragResizeBegin 3 //Drag Resizing event begin.
#define xtpCalendarEO_DragResizeEnd 4 //Drag Resizing event end.
#define xtpCalendarEO_EditSubject_ByF2 5 //In-place edit event by pressing F2 key.
#define xtpCalendarEO_EditSubject_ByMouseClick 6 //In-place edit event by mouse click.
#define xtpCalendarEO_EditSubject_ByTab 7 //In-place edit event tab key.
#define xtpCalendarEO_EditSubject_AfterEventResize 8 //In-place edit event after resizing an event.
#define xtpCalendarEO_Cut 9 //Cut events.
#define xtpCalendarEO_Copy 10 //Copy events.
#define xtpCalendarEO_Paste 11 //Paste event.
#define xtpCalendarEO_DeleteSelectedEvents 12 //Delete selected events.
#define xtpCalendarEO_DeleteEvent 13 //Delete event. Sent for a single event or for each selected event.
#define xtpCalendarEO_InPlaceCreateEvent 14 //In-place event creation.
//-------------- events
#define xtpCalendarImportanceLow 0
#define xtpCalendarImportanceNormal 1
#define xtpCalendarImportanceHigh 2
#define xtpCalendarBusyStatusFree 0
#define xtpCalendarBusyStatusTentative 1
#define xtpCalendarBusyStatusBusy 2
#define xtpCalendarBusyStatusOutofOffice 3
//---------------------------------------------------//
CLASS MpCal
DATA dCurrentDate AS DATE INIT Date()
DATA oCalex
DATA oCalexCapBar
DATA oCalexStdDlgs
DATA oGlbSettings
DATA oDtPick
DATA oExBar
DATA oPanelExplorer
DATA oPanelCalex
DATA oCWnd
DATA oApt // Data object for appointments
DATA aCalEvtObj
DATA lDoInsert // Flag for inserting new events : .F. for repeat objects
DATA oEvent
DATA lBuildMVCC
METHOD New()
METHOD BuildCalex()
METHOD BuildDatePicker()
METHOD BuildPanels()
METHOD BuildStdDialogs( )
METHOD SetSize( nType, nWidth, nHeight )
METHOD xTrmCalTriggeredEvents( Event, Parms )
METHOD RetrieveDayEvents( aParms )
METHOD InsertEvent( oEvent )
METHOD UpdateEvent( oEvent )
METHOD DeleteEvent( oEvent )
METHOD EditEvent( oEvent )
METHOD GetUniqueId() INLINE { AllTrim( Str( nRandom( 10000 ) ) ), nRandom( 10000 ) }
METHOD ApptDetail() VIRTUAL
ENDCLASS
//---------------------------------------------------//
METHOD New() CLASS MpCal
local oMenu, oCIcon, oBar
local oSelf := Self
// ::aAsgnTo := {}
::lDoInsert := .t. // Add event flag
::oApt := TDataBase():New( , "aswapt" )
::oApt:use()
::oApt:setorder( "aswuid" )
::oApt:gotop( )
oMenu := MenuBegin( .F.,,, .F. )
MenuEnd()
// Create the window
DEFINE WINDOW ::oCwnd MDI FROM 0,0 TO 800, 1150 PIXEL MENU oMenu Title "Appointment Scheduler"
// Create the button bar
DEFINE BUTTONBAR oBar OF ::oCwnd SIZE 50,60 2007
DEFINE BUTTON OF oBar RESOURCE "CAL1.bmp" PROMPT "Day" ACTION ::oCalex:ViewType := 0 TOOLTIP "Day View"
DEFINE BUTTON OF oBar RESOURCE "CAL5.bmp" PROMPT "Work" ACTION ::oCalex:ViewType := 1 TOOLTIP "Work Week View"
DEFINE BUTTON OF oBar RESOURCE "CAL7.bmp" PROMPT "Week" ACTION ::oCalex:ViewType := 2 TOOLTIP "Full Week View"
DEFINE BUTTON OF oBar RESOURCE "CAL31.bmp" PROMPT "Month" ACTION ::oCalex:ViewType := 3 TOOLTIP "Month View"
DEFINE BUTTON OF oBar RESOURCE "HRPRINT.bmp" PROMPT "Views" ACTION ::oCalex:PrintPreview(.t.) TOOLTIP "Print calendar views"
// License embedded settings
::oGlbSettings := CreateObject( "CodeJock.CalendarGlobalSettings.15.0.1" )
// ::oGlbSettings:License = "Calendar Control Copyright (c) 2003-2011 Codejock Software" + CRLF + ;
// "PRODUCT-ID: Codejock.Calendar.ActiveX.v15.0" + CRLF + "VALIDATE-CODE: XXX-XXX-XXX-XXX"
// Build the calendar
::BuildPanels()
::BuildCalex()
::BuildDatePicker()
::BuildStdDialogs( )
ACTIVATE WINDOW ::oCwnd MAXIMIZED ;
ON RESIZE oSelf:SetSize( nSizeType, nWidth, nHeight )
RETURN Self
//-----------------------------------------------------------------------------------------------------//
METHOD xTrmCalTriggeredEvents( Event, aParms ) CLASS MpCal
LOCAL opParms, oEvent
if valType( Event ) == "C"
Do Case
Case Event == "DoRetrieveDayEvents"
::RetrieveDayEvents( aParms )
Case Event == "DblClick"
//make sure we trap a DblClick on day or week view.
//Check for ViewEvent() != Nil garantees that EventDetails will not be executed
//when clicking on a blank space with no event previously created
if ::oCalex:ViewType() < xtpCalendarMonthView .and. ;//day or week view only
( oEvent := ::oCalex:ActiveView():HitTest():ViewEvent() ) != nil
oEvent := oEvent:Event()
oEvent := ::EditEvent( oEvent )
endif
case Event == "BeforeEditOperation"
OpParms := aParms[ 1 ]
// aparms[ 1 ] holds a pointer to CalendarEditOperationParameters object.
// This object is referred to as opParms on documentation.
// OpParms:Operation is the edit operation taking place from Enumeration list
// OpParms:EventViews is an Object acting as an array with all event objects
// marked for editing on the calendar control.
// OpParms:EventViews:Count() length of the array
// OpParms:EventViews:ViewEvent( n ) returns the nth event in EventViews.
// aparms[ 2 ] sent by ref to inform .t. to cancel the operation of .f. to allow it.
if ; // OpParms:Operation() == xtpCalendarEO_EditSubject_ByMouseClick .or. ;
OpParms:Operation() == xtpCalendarEO_EditSubject_ByF2
aParms[ 2 ] := .t.
if OpParms:EventViews:Count() > 0
::EditEvent( OpParms:EventViews:ViewEvent( 0 ), aParms )
endif
endif
case Event == "DoCreateEvent"
// When repeating, we want this false because the data is inserted in that method.
IF ::lDoInsert
::InsertEvent( aParms[ 1 ], @aParms[2], @aParms[3] )
ENDIF
case Event == "DoUpdateEvent" .and. aParms[ 1 ]:CustomProperties:Property( "id" ) != Nil
::UpdateEvent( aParms[ 1 ] )
case Event == "EventDeletedEx" .and. aParms[ 1 ]:CustomProperties:Property( "id" ) != Nil
::DeleteEvent( aParms[ 1 ] )
End
endif
Return nil
//-----------------------------------------------------------------------------------------------------//
METHOD InsertEvent( oEvent, nId, lResult ) CLASS MpCal
// First obtain a unique ID for this event
local aId := ::GetUniqueId( )
// Add a record to the database for a new event
::oApt:append()
::oApt:blank()
::oApt:aptuid := aId[1] //cId
::oAPt:aptseq := aId[2]
::oApt:aptsum := oEvent:Subject()
::oApt:aptbeg := Left( TtoS( oEvent:StartTime() ), 14 )
::oApt:aptend := Left( TtoS( oEvent:EndTime() ), 14 )
::oApt:aptnot := oEvent:Body()
::oApt:aptdat := StoD( SUBSTR( ::oApt:aptbeg, 1, 8 ))
::oAPt:aptbti := SUBSTR( ::oApt:aptbeg,9,2 ) + ":" + SUBSTR( ::oApt:aptbeg,11,2 )
::oApt:apteti := SUBSTR( ::oApt:aptend,9,2 ) + ":" + SUBSTR( ::oApt:aptend,11,2 )
::oApt:aptclr := "0"
::oApt:aptron := .f.
::oApt:aptald := .f.
::oApt:aptmtg := .f.
::oApt:aptpri := .f.
::oApt:aptimp := 1
::oApt:aptbsy := 0
::oApt:save( )
nId := ::oApt:AptSeq
lResult := .t.
// Every time a new appointment is added on the calendar control you could expand
// appointment details with a custom form where you may pickup other values.
::ApptDetail( oEvent )
Return oEvent
//-----------------------------------------------------------------------------------------------------//
METHOD UpdateEvent( oEvent ) CLASS MpCal
// Make sure we have the proper id
local cid := oEvent:CustomProperties:Property( "id" )
// Search for the right record in the database and then we can edit it
::oApt:seek( cId )
IF ::oApt:found()
::oApt:aptsum := oEvent:Subject()
::oApt:aptbeg := Left( TtoS( oEvent:StartTime() ), 14 )
::oApt:aptend := Left( TtoS( oEvent:EndTime() ), 14 )
::oApt:aptdat := StoD( SUBSTR( ::oApt:aptbeg, 1, 8 ) )
::oApt:aptbti := SUBSTR( ::oApt:aptbeg,9,2 ) + ":" + SUBSTR( ::oApt:aptbeg,11,2 )
::oApt:apteti := SUBSTR( ::oApt:aptend,9,2 ) + ":" + SUBSTR( ::oApt:aptend,11,2 )
::oApt:save( )
ELSE
MsgAlert( "Record match could not be found" )
ENDIF
return oEvent
METHOD EditEvent( oEvent ) CLASS MpCal
// Make sure we have the proper id
local cid := oEvent:CustomProperties:Property( "id" )
// Search for the right record in the database and then we can edit it
::oApt:seek( cId )
IF ::oApt:found()
oEvent := ::ApptDetail( oEvent )
ELSE
MsgAlert( "Record match could not be found" )
ENDIF
return oEvent
//-----------------------------------------------------------------------------------------------------//
METHOD DeleteEvent( oEvent ) CLASS MpCal
local cid := oEvent:CustomProperties:Property( "id" )
::oAPt:seek( cId )
IF ::oApt:found()
IF MsgNoYes( "Do you wish to delete this appointment ?" )
::oAPt:Delete()
ENDIF
ENDIF
return oEvent
//-----------------------------------------------------------------------------------------------------//
//aParms[ 1 ] contains a datetime value. This function should return all the events found on
//calendar.dbf for that date. To extract only the date portion of aparms[ 1 ],
//we convert the datetime value to string and then pullout the first 8 chars as in YYYYMMDD.
METHOD RetrieveDayEvents( aParms ) CLASS MpCal
local oEvent
local cDate := Left( TtoS( aParms[ 1 ] ), 8 )
local oEvents := aParms[ 2 ]
local nRecno := ::oApt:recno()
local nOrder := ::oApt:setOrder()
::oApt:setorder( "aswbeg" )
::oApt:gotop( )
::oApt:Seek( cDate )
WHILE ! ::oApt:eof() .AND. left( ::oApt:aptbeg, 8 ) == cDate
oEvent := ::oCalex:DataProvider:CreateEventEx( ::oApt:aptseq )
WITH Object oEvent
:Subject = (::oApt:aptsum)
:StartTime = ( StoT( ::oApt:aptbeg ) )
:EndTime = ( StoT( ::oApt:aptend ) )
:body = ( ::oApt:aptnot )
:Label = ( ::oApt:aptclr )
:Reminder = ( ::oApt:aptrem )
:ReminderMinutesBeforeStart = ( ::oApt:aptitv )
:AllDayEvent = ( ::oApt:AptAld )
:MeetingFlag = ( ::oApt:AptMtg )
:PrivateFlag = ( ::oApt:AptPri )
:Importance = ( ::oAPt:AptImp )
:BusyStatus = ( ::oApt:AptBsy )
END
oEvents:add( oEvent )
::oApt:Skip( )
END
::oApt:setorder( nOrder )
::oApt:goto( nRecno )
Return Nil
//---------------------------------------------------------------------------------------------------//
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
// ? :UseMultiColumnWeekMode( .t. )
// ? :SwitchToDayViewIfPickedSingleDay( .t. )
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( TOleAuto():New( ::oCalex:oOleAuto:__hObj ) ) )
End
::oPanelExplorer:oClient := ::oDtPick
CATCH oErr
END
RETURN nil
//---------------------------------------------------//
METHOD BuildStdDialogs() CLASS MpCal
local oErr
TRY
::oCalexStdDlgs := CreateObject( "Codejock.CalendarDialogs.15.0.1" )
// This line is generating an error
::oCalexStdDlgs:Calendar = TOleAuto():New( ::oCalex:oOleAuto:__hObj )
::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
//---------------------------------------------------//
METHOD SetSize( nType, nWidth, nHeight ) CLASS MpCal
// local nCntrl := aScan( ::oCwnd:aControls, { |e| upper( e:ClassName() ) $ "TTOOLBAR,TREBAR", "TBar" } )
if nWidth != nil
// if nCntrl > 0 .and. nHeight != Nil ; nHeight -= ::oCwnd:aControls[ nCntrl ]:nHeight ;endif
nHeight -= 60
::oPanelExplorer:Move( , , , nHeight )
::oPanelCalex:Move( , , nWidth - ::oPanelExplorer:nRight, nHeight )
endif
RETURN nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 42 guests