Page 1 of 8

Codejock Calendar Samples?

Posted: Fri May 29, 2009 1:20 am
by Jeff Barnes
Hi,

I am playing with the Codejock calendar demo and wonder if anyone can guide me as to how to use the commands.

I am able to get a calendar on the screen from reading other posts but that's about all I can get working. (First time working with ActiveX)

I just don't know how to issue the commands to do anything.

Are there any samples files that show how to use Codejock with FWH ?

Code: Select all

#include "FiveWin.ch"
function Main()  
   local oWnd, oAct

   DEFINE WINDOW oWnd
     oAct := TActiveX():New( oWnd, "Codejock.CalendarControl.13.0.0", 10, 0, 1000, 550 )   
   ACTIVATE WINDOW oWnd

return nil

 

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 1:43 am
by Jeff Barnes
Looks like no one else has played with the Calendar control from Codejock????

Here is what I have been able to get working so far...

Code: Select all

//start the calendar object
oAct := TActiveX():New( oWnd, "Codejock.CalendarControl.13.0.0", 100, 0, 1000, 550 )   


//Use XML as the data provider
oAct:SetDataProvider:="Provider=XML;Data Source=\YourPath\Events.xml"

//Create a blank data provider using info from above
//(no need to OPEN it after a create)
oAct:DataProvider:Create()

//If data provider is already created you can just open it
oAct:DataProvider:Open()

//Set the time scale in day view
oAct:DayView:Timescale := 30

//show a specific date when starting
oAct:ActiveView:ShowDay:= Date()

//Set the view (in this case the "day" view
oAct:ViewType:=xtpCalendarDayView

//Set the normal working hours (show up in different color)
oAct:Options:WorkDayStartTime("8:00:00 AM")
oAct:Options:WorkDayEndTime("8:00:00 PM")

//Scroll the time to "WorkDayStartTime"
oAct:DayView:ScrollToWorkDayBegin()

//Set the week view to "work week" (5 days) instead of a 7 day week
oAct:ViewType:= xtpCalendarWorkWeekView

//Set the theme
oAct:VisualTheme:=xtpCalendarThemeOffice2007

//Show/Hide the time line button
oAct:ShowTimelineButton:=  .f.

//Set/Hide Caption Bar
oAct:ShowCaptionBar:= .t.

//Show/Hide the date scroll buttons
oAct:ShowCaptionBarScrollDateButtons:= .t.

 

I am still trying to figure out how to add and retrieve and event via programming.
Also need to figure out how to set cell colors.


If anyone has info to add, please do.

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 1:58 am
by Jeff Barnes
Here are some sample screen shots of the calendar from the code in the previous post.

Image

Image

Image

Image

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 3:53 am
by dutch
Dear Jeff,

It's very good sample. Can we use DBF file instead of XML file?

Regards,
Dutch

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 1:03 pm
by Jeff Barnes
You can connect to other data sources like Access, MySql, etc...
I am trying to connect (via ODBC) to the database I have created in MySQL but no luck so far.

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 8:15 pm
by dutch
Dear Jeff,

I can connect via TMySql without ODBC. Just add 2 LIB files, that's all.

http://forums.fivetechsupport.com/viewt ... =3&t=15625

Regards,
Dutch

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 10:37 pm
by TimStone
I have not worked with this recently. However, when I discussed it with the people at Codejock ( they are really nice and offer to be helpful ), we can write our own code to work with .dbf files, or we can use the memory model and then save the elements to the file. That does involve essentially loading / unloading data from the disk and that could slow down the process.

I've been thinking about playing with it again ... the interface would be nice.

Re: Codejock Calendar Samples?

Posted: Sun Jun 07, 2009 12:16 am
by Jeff Barnes
Hi Dutch,

It's not my app that I am trying to get connected to MySQL (I achieved this via Mediator ... I wanted to be able to use the MySQL tables like DBF files) but the actual calendar control.

Re: Codejock Calendar Samples?

Posted: Sun Jun 07, 2009 4:19 pm
by norberto
hi, i need this with dbf or adt files, someone try with sucess?? thanks

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 3:59 pm
by reinaldocrespo
Hi everyone;

Just came across this post, and thought I should share some answers. Yes, CodeJock calendar control does work with dbfs/ adts/ xml/ mdb/ SQL/ arrays/ Objects, or just about any other type of data.

Here is a short sample on working with a tdata class based on dbfs. I'm trying to keep the code simple. The intent is show how to connect dbf data to CodeJock ExtremeCalendar Control:

Code: Select all

//create the object
::oCalex := tActiveX():New( ::oPanelCalex, "Codejock.CalendarControl.13.4.2" )

//set some properties
with object ::oCalex
    
    :VisualTheme( xtpCalendarThemeOffice2007 )
    :bOnEvent = { | event, aParms | ::xTrmCalTriggeredEvents( Event, aParms ) }
        
    :SetDataProvider( "provider=custom" )
    if !:DataProvider:open()    ;:DataProvider:Create() ;endif
        
    :ShowCaptionBar( .t. )
    :ViewType( xtpCalendarDayView )

    :DayView:ShowLinks( .t. )
    :DayView:TimeScaleMinTime( [8:00:00 AM] )
    :DayView:TimeScaleMaxTime( [6:00:00 PM] )
    :DayView:TimeScale( 10 )
    :DayView:ScrollToWorkDayBegin()     //scroll the view to the work day starting time

    :Options:DayViewTimeScaleShowMinutes( .t. )

end

 
//now all you have to do is create the triggered events to write/read from dbfs

Code: Select all

//-----------------------------------------------------------------------------------------------------//
METHOD xTrmCalTriggeredEvents( Event, aParms ) CLASS MpCal

    if valType( Event ) == "C"

        Do Case

        Case Event == "DoRetrieveDayEvents"         
            ::RetrieveDayEvents( aParms )

        case Event == "EventAddedEx"
            ::InsertEvent( aParms[ 1 ] )

        case Event == "EventChangedEx"
            ::UpdateEvent( aParms[ 1 ] )

        case Event == "EventDeletedEx"
            ::DeleteAppnt( aParms[ 1 ] )
            
        End 

    endif
    
Return nil

//-----------------------------------------------------------------------------------------------------//
METHOD InsertEvent( oEvent ) CLASS MpCal
    ::odbf:VarSubject   := oEvent:Subject()
    ::odbf:VarStartTime := oEvent:StartTime()
    ::odbf:VarEndTime   := oEvent:EndTime()
    ::odbf:VarMore_Info := oEvent:Body()
    
    ::odbf:Append()
    ::odbf:Save() 

    //fill in a custom property on this entry to link to unique key on dbf.  Field Guid is auto-field using 
    //an On-Insert trigger on the dbf and it defaults to a global unique string used as primary key.
    oEvent:CustomProperties:Property( "guid", ::odbf:Guid )

    //every time a new appointment is added on the calendar control
    //expand appntmnt details with a custom form for tel, med rec, email...
    ::EventDetails( oEvent )
        
Return oEvent

//-----------------------------------------------------------------------------------------------------//
//using SQL is less writing, but the same can be done with ISAM.
METHOD UpdateEvent( oEvent ) CLASS MpCal
local cSql := "Update appntmnts set Subject = '" + oEvent:Subject() + "', " +;
                "StartTime = Convert( '" + TtoC( oEvent:StartTime() ) + "', SQL_TIMESTAMP ), " +;
                "EndTime = Convert( '" + TtoC( oEvent:EndTime() ) + "', SQL_TIMESTAMP ), " +;
                "More_Info = '" + oEvent:Body() + "' " + ;
                "Where guid = '" + oEvent:CustomProperties:Property( "Guid" ) + "'"
                    
                
    ExecuteSqlScript( cSql, .f. )
    ::EventDetails( oEvent )

return oEvent

//-----------------------------------------------------------------------------------------------------//
METHOD DeleteAppnt( oEvent ) CLASS MpCal
local cSql := "Delete from appntmnts " + ;
        "Where guid = '" + oEvent:CustomProperties:Property( "Guid" ) + "'"
                    
                
    ExecuteSqlScript( cSql, .f. )

return oEvent

//-----------------------------------------------------------------------------------------------------//
//CodeJock ExtremeCalender control calls this function sending a DT parameter and 
//the container property that contains all the day entries.  The function should fill in 
//the container property with all day events (appointments)

METHOD RetrieveDayEvents( aParms ) CLASS MpCal
Local cSql := "Select mrec, Subject, Last_Name, First_Name, StartTime, EndTime, eMail, Tel, GuId, More_Info " + ;
                "from appntmnts where convert( StartTime, SQL_DATE )= '" + Date2SqlString( aParms[ 1 ] ) + "'"
local arec
local aRet := ExecuteSQLScript( cSql, .f. )
local oEvents := aParms[ 2 ] 
local oEvent
    
    for each arec in aret

        oEvent := ::oCalex:DataProvider:CreateEvent()

        With Object oEvent
            :Subject( aRec[ 2 ] ) //TokenUpper( trim( aRec[ 3 ] ) + " " + trim( arec[ 4 ] ) ) )
            :StartTime( aRec[ 5 ] )
            :EndTime( aRec[ 6 ] )
            :body( arec[ 10 ] )
            
            :CustomProperties:Property( "MRec", alltrim( aRec[ 1 ] ) )
            :CustomProperties:Property( "Guid", aRec[ 9 ] )
            :CustomProperties:Property( "Tel", aRec[ 8 ] )
            :CustomProperties:Property( "eMail", aRec[ 7 ] )
            
        End
        
        oEvents:add( oEvent )

    next 
    
Retur Nil


 

It works really nice. If anyone needs help, I'll be glad to offer my help. Here is a screenshot:
Image

Reinaldo.

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 4:13 pm
by reinaldocrespo
And here is another screenshot:
Image

Image

Reinaldo.

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 4:19 pm
by mgsoft
Thanks for sharing!!.

Also, Daniel is preparing a Calendar for FW!!

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 4:23 pm
by Richard Chidiak
Reinaldo

This is excellent news

What about the licensing of this control ? How can it be included with an existing application

Thanks for your help,

Richard

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 4:26 pm
by richard-service
Nice job.
I think Codejock have more UI than FWH.

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 4:34 pm
by reinaldocrespo
About licensing:

http://www.codejock.com/purchase/

ExtremeCalendar ActiveX control is $149.00. There is a 30 day free trial offer. Good for testing and development.


Reinaldo.