Silvio wrote:For all :
New two methods to insert to CLASS TCalEx
METHOD RButtonDown( nRow, nCol, nKeyFlags )
it create a simply menu popup with these operation
call a function to insert or modifiy a record
Set a date
Go to a date
set Interval
as you can see on this picture
Write YOur impressions!!
- Code: Select all Expand view
METHOD RButtonDown( nRow, nCol, nKeyFlags ) CLASS TCalEx
Local oMenu
Local oThis := self
if ::Classname() != "TDAYVIEW" .or. ::Classname() != "TWEEKVIEW"
if ::bRClicked != nil
return Eval( ::bRClicked, nRow, nCol, nKeyFlags, Self )
endif
MENU oMenu POPUP
MENUITEM "New appointment" ACTION msginfo("New Record")
MENUITEM "Today" ACTION (::SetDate( date() ) ,::oDayView:refresh())
MENUITEM "Go to date " ACTION (::GotoDate(nRow, nCol) ,::oDayView:refresh())
MENUITEM "Interval"
MENU
MENUITEM "5 minutes" ACTION (::oDayView:SetInterval( 5 ) ,::oDayView:refresh())
MENUITEM "10 minutes" ACTION (::oDayView:SetInterval( 10 ) ,::oDayView:refresh())
MENUITEM "15 minutes" ACTION (::oDayView:SetInterval( 15 ) ,::oDayView:refresh())
MENUITEM "20 minutes" ACTION (::oDayView:SetInterval( 20 ) ,::oDayView:refresh())
MENUITEM "30 minutes" ACTION (::oDayView:SetInterval( 30 ) ,::oDayView:refresh())
MENUITEM "60 minutes" ACTION (::oDayView:SetInterval( 60 ) ,::oDayView:refresh())
ENDMENU
ENDMENU
ACTIVATE POPUP oMenu OF oThis AT nRow, nCol
ENDIF
return nil
#include "dtpicker.ch"
METHOD GotoDate() CLASS TCalEx //add by silvio
LOCAL oDlg, oGet, lChg:=.F. ,oBut[2]
LOCAL dDate:=Date()
DEFINE DIALOG oDlg SIZE 210,80 TITLE "Go to a date"
@ 0.8,2 DTPICKER oGet VAR dDate OF oDlg SIZE 80,10;
ON CHANGE oGet:Refresh()
@ 0.2, 2 SAY "Select a new date" OF oDlg SIZE 80,7
@ 28, 2 BUTTON oBut[1] Prompt "&Confirm" SIZE 30, 10 PIXEL OF oDlg ACTION (lChg:=.T.,oDlg:End())
@ 28, 35 BUTTON oBut[2] Prompt "Ca&ncel" SIZE 30, 10 PIXEL OF oDlg ACTION (lChg:=.F.,oDlg:End()) CANCEL
ACTIVATE DIALOG oDlg CENTER
IF lChg
::SetDate(dDate)
ENDIF
RETURN (NIL)
if ::bRClicked != nil
return Eval( ::bRClicked, nRow, nCol, nKeyFlags, Self )
endif
#xcommand DEFINE CALEX <oCalex>;
[ <of: OF, WINDOW, DIALOG, PANEL> <oWnd> ];
[ FIRST_DATE <nFirst> ];
=> ;
[ Calex_SetFirstDate( <nFirst> ) ];;
<oCalex> := TCalex():New( <oWnd> )
#xcommand DEFINE MONTH [ VIEW ] <of: OF, CALEX> <oCalex>;
[ ON SELECT VIEW <uSelectView> ] ;
[ ON SELECT DAY <uSelected> ] ;
[ ON SELECT WEEK <uWeek> ] ;
[ ON NEXT <uNext> ] ;
[ ON PREV <uPrev> ] ;
[ ON DELETE <uDelete> ];
[ START HOUR <nStart> ];
[ END HOUR <nEnd> ];
[ <lActivate: ACTIVATE> ];
=> ;
WITH OBJECT <oCalex>;;
[ :oMonthView:bSelectView := \{ | Self, oLast| <uSelectView> \} ] ;;
[ :oMonthView:bSelected := \{ | Self, dDate| <uSelected> \} ] ;;
[ :oMonthView:bSelectedWeek := \{ | Self, nWeek, dDate | <uWeek> \} ] ;;
[ :oMonthView:bOnNext := \{ | Self, dDate| <uNext> \} ] ;;
[ :oMonthView:bOnPrev := \{ | Self, dDate| <uPrev> \} ] ;;
[ :oMonthView:bOnDelete := \{ | Self, nIdx | <uDelete> \} ] ;;
[ :oMonthView:nStartHour := <nStart> ] ;;
[ :oMonthView:nEndHour := <nEnd> ];;
[ If( <.lActivate.>, :SetMonthView(), ) ];;
END <oCalex>
#xcommand DEFINE DAY [ VIEW ] <of: OF, CALEX> <oCalex>;
[ ON SELECT VIEW <uSelectView> ] ;
[ ON LEFT CLICK <uSelected> ] ;
[ ON RIGHT CLICK <uRSelected> ];
[ ON NEXT <uNext> ] ;
[ ON DELETE <uDelete> ];
[ ON PREV <uPrev> ] ;
[ START HOUR <nStart> ];
[ END HOUR <nEnd> ];
[ INTERVAL <nInterval> ];
[ AMPM <lAmPm> ];
[ <lActivate: ACTIVATE> ];
=> ;
WITH OBJECT <oCalex>;;
[ :oDayView:bSelected := \{ | nRow, nCol, Self, dDateFrom, nTimeFrom, nTimeTo | <uSelected> \} ] ;;
[ :oDayView:bSelectView := \{ | Self, oLast| <uSelectView> \} ] ;;
[ :oDayView:bOnNext := \{ | Self, dDate| <uNext> \} ] ;;
[ :oDayView:bOnPrev := \{ | Self, dDate| <uPrev> \} ] ;;
[ :oDayView:bOnDelete := \{ | Self, nIdx | <uDelete> \} ] ;;
[ :oDayView:bRSelected := \{ | nRow, nCol, Self, dDateFrom, dDateTo, nTimeFrom, nTimeTo | <uRSelected> \} ] ;;
[ :oDayView:nStartHour := <nStart> ] ;;
[ :oDayView:nEndHour := <nEnd> ];;
[ :oDayView:SetInterval( <nInterval> ) ];;
[ :oDayView:lAmPm := <.lAmPm.> ];;
[ If( <.lActivate.>, :SetDayView(), ) ];;
END <oCalex>
#xcommand DEFINE WEEK [ VIEW ] <of: OF, CALEX> <oCalex>;
[ ON SELECT VIEW <uSelectView> ] ;
[ ON LEFT CLICK <uSelected> ] ;
[ ON RIGHT CLICK <uRSelected> ];
[ ON NEXT <uNext> ] ;
[ ON PREV <uPrev> ] ;
[ ON DELETE <uDelete> ];
[ START HOUR <nStart> ];
[ END HOUR <nEnd> ];
[ INTERVAL <nInterval> ];
[ AMPM <lAmPm> ];
[ <lActivate: ACTIVATE> ];
=> ;
WITH OBJECT <oCalex>;;
[ :oWeekView:bSelected := \{ | nRow, nCol, Self, dDateFrom, dDateTo, nTimeFrom, nTimeTo | <uSelected> \} ] ;;
[ :oWeekView:bSelectView := \{ | Self, oLast | <uSelectView> \} ] ;;
[ :oWeekView:bOnNext := \{ | Self, dDate | <uNext> \} ] ;;
[ :oWeekView:bOnPrev := \{ | Self, dDate | <uPrev> \} ] ;;
[ :oWeekView:bRSelected := \{ | nRow, nCol, Self, dDateFrom, dDateTo, nTimeFrom, nTimeTo | <uRSelected> \} ] ;;
[ :oWeekView:bOnDelete := \{ | Self, nIdx | <uDelete> \} ] ;;
[ :oWeekView:nStartHour := <nStart> ] ;;
[ :oWeekView:nEndHour := <nEnd> ];;
[ :oWeekView:SetInterval( <nInterval> ) ];;
[ :oWeekView:lAmPm := <.lAmPm.> ];;
[ If( <.lActivate.>, ( :SetWeekView(), :Resize() ), ) ];;
END <oCalex>
Daniel Garcia-Gil wrote:i will post a new sample (without source code)
#xcommand DEFINE CALEX <oCalex>;
[ <of: OF, WINDOW, DIALOG, PANEL> <oWnd> ];
[ FIRST_DATE <nFirst> ];
=> ;
[ Calex_SetFirstDate( <nFirst> ) ];;
<oCalex> := TCalex():New( <oWnd> )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 49 guests