FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Codejock Calendar Samples?
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Codejock Calendar Samples?

Posted: Fri May 29, 2009 01:20 AM
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 (fw): Select all Collapse
#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
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 01:43 AM
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 (fw): Select all Collapse
//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.
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 01:58 AM
Here are some sample screen shots of the calendar from the code in the previous post.







Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 03:53 AM

Dear Jeff,

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

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 01:03 PM

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.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 08:15 PM

Dear Jeff,

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

viewtopic.php?f=3t=15625

Regards,
Dutch

&

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM

Re: Codejock Calendar Samples?

Posted: Wed Jun 03, 2009 10:37 PM

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.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM

Re: Codejock Calendar Samples?

Posted: Sun Jun 07, 2009 12:16 AM

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.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM

Re: Codejock Calendar Samples?

Posted: Sun Jun 07, 2009 04:19 PM

hi, i need this with dbf or adt files, someone try with sucess?? thanks

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 03:59 PM
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 (fw): Select all Collapse
//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 (fw): Select all Collapse
//-----------------------------------------------------------------------------------------------------//
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:


Reinaldo.
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 04:13 PM
And here is another screenshot:




Reinaldo.
Posts: 422
Joined: Mon Aug 17, 2009 12:18 PM

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 04:19 PM

Thanks for sharing!!.

Also, Daniel is preparing a Calendar for FW!!

Saludos,



Eduardo
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 04:23 PM

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

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 04:26 PM

Nice job.
I think Codejock have more UI than FWH.

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM

Re: Codejock Calendar Samples?

Posted: Thu Jan 13, 2011 04:34 PM
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.