Function OnGetState( oCal, lSun, lSat )
LOCAL i, imax, j, jmax, nDay, nDayState, nMonth
LOCAL dStartDate
LOCAL dCurrentDay := oCal:dDate
oCal:GetMonthRange()
dStartDate = oCal:dDate
imax := Len( oCal:aDayState )
nMonth := Month( dStartDate )
FOR i:=1 TO imax
nDayState := 0
FOR j:=1 TO 31
nDay := DoW( dStartDate ) - 2
IF nDay < 0
nDay += 7
ENDIF
IF nDay == 5 .AND. lSat
oCal:SetArrayDayState( i, j )
ENDIF
IF nDay == 6 .AND. lSUN
oCal:SetArrayDayState( i, j )
ENDIF
dStartDate ++
IF Month( dStartDate ) <> nMonth
EXIT
ENDIF
NEXT
nMonth := Month( dStartDate )
NEXT
oCal:SetDate( dCurrentDay )
return nil
#include "fivewin.ch"
#include "calendar.ch"
FUNCTION Main()
LOCAL oCal, oWnd
LOCAL dDate := Date()
LOCAL lSunday := .T.
LOCAL lSaturday := .T.
DEFINE WINDOW oWnd
@ 0,0 CALENDAR oCal VAR dDate OF oWnd DAYSTATE
OnGetState( oCal, lSunday, lSaturday )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, lSunday, lSaturday ) }
ACTIVATE WINDOW oWnd
RETURN NIL
Function OnGetState( oCal, lSun, lSat )
LOCAL i, imax, j, jmax, nDay, nDayState, nMonth
LOCAL dStartDate
LOCAL dCurrentDay := oCal:dDate
oCal:GetMonthRange()
dStartDate = oCal:dDate
imax := Len( oCal:aDayState )
nMonth := Month( dStartDate )
FOR i:=1 TO imax
nDayState := 0
FOR j:=1 TO 31
nDay := DoW( dStartDate ) - 2
IF nDay < 0
nDay += 7
ENDIF
IF nDay == 5 .AND. lSat
oCal:SetArrayDayState( i, j )
ENDIF
IF nDay == 6 .AND. lSUN
oCal:SetArrayDayState( i, j )
ENDIF
dStartDate ++
IF Month( dStartDate ) <> nMonth
EXIT
ENDIF
NEXT
nMonth := Month( dStartDate )
NEXT
oCal:SetDate( dCurrentDay )
return nil
#include "fivewin.ch"
#include "calendar.ch"
FUNCTION TestClndr()
LOCAL oCal, oWnd
LOCAL dDate := Date()
LOCAL lSunday := .T.
LOCAL lSaturday := .T.
DEFINE DIALOG oWnd2 RESOURCE "CALENDAR2"
REDEFINE CALENDAR oCal VAR dDate OF oWnd2 ID 2010
ACTIVATE WINDOW oWnd2 ON INIT InitState( oCal, lSunday, lSaturday )
RETURN NIL
FUNCTION InitState( oCal, lSunday, lSaturday )
OnGetState( oCal, lSunday, lSaturday )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, lSunday, lSaturday ) }
ACTIVATE WINDOW oWnd2
RETURN NIL
Function OnGetState( oCal, lSun, lSat )
LOCAL i, imax, j, jmax, nDay, nDayState, nMonth
LOCAL dStartDate
LOCAL dCurrentDay := oCal:dDate
oCal:GetMonthRange()
dStartDate = oCal:dDate
MsgInfo( dStartDate )
imax := Len( oCal:aDayState )
nMonth := Month( dStartDate )
MsgInfo( nMonth )
FOR i:=1 TO imax
nDayState := 0
FOR j:=1 TO 31
nDay := DoW( dStartDate ) - 2
IF nDay < 0
nDay += 7
ENDIF
IF nDay == 5 .AND. lSat
oCal:SetArrayDayState( i, j )
ENDIF
IF nDay == 6 .AND. lSUN
oCal:SetArrayDayState( i, j )
ENDIF
dStartDate ++
IF Month( dStartDate ) <> nMonth
EXIT
ENDIF
NEXT
nMonth := Month( dStartDate )
NEXT
oCal:SetDate( dCurrentDay )
return nil
CALENDAR2 DIALOG DISCARDABLE 0, 0, 300, 200
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "Testing"
FONT 8, "Microsoft Sans Serif"
BEGIN
CONTROL "",2010,"SysMonthCal32",WS_CHILD |WS_TABSTOP |WS_VISIBLE|MCS_DAYSTATE , 10,30,169,100
END
#include "fivewin.ch"
#include "calendar.ch"
FUNCTION TestClndr()
LOCAL oCal, oWnd
LOCAL dDate := Date()
LOCAL lSunday := .T.
LOCAL lSaturday := .T.
DEFINE DIALOG oWnd2 RESOURCE "CALENDAR2"
REDEFINE CALENDAR oCal VAR dDate OF oWnd2 ID 2010
ACTIVATE DIALOG oWnd2 ON INIT InitState( oCal, lSunday, lSaturday )
RETURN NIL
FUNCTION InitState( oCal, lSunday, lSaturday )
OnGetState( oCal, lSunday, lSaturday )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, lSunday, lSaturday ) }
RETURN NIL
Function OnGetState( oCal, lSun, lSat )
LOCAL i, imax, j, jmax, nDay, nDayState, nMonth
LOCAL dStartDate
LOCAL dCurrentDay := oCal:dDate
oCal:GetMonthRange()
dStartDate = oCal:dDate
MsgInfo( dStartDate )
imax := Len( oCal:aDayState )
nMonth := Month( dStartDate )
MsgInfo( nMonth )
FOR i:=1 TO imax
nDayState := 0
FOR j:=1 TO 31
nDay := DoW( dStartDate ) - 2
IF nDay < 0
nDay += 7
ENDIF
IF nDay == 5 .AND. lSat
oCal:SetArrayDayState( i, j )
ENDIF
IF nDay == 6 .AND. lSUN
oCal:SetArrayDayState( i, j )
ENDIF
dStartDate ++
IF Month( dStartDate ) <> nMonth
EXIT
ENDIF
NEXT
nMonth := Month( dStartDate )
NEXT
oCal:SetDate( dCurrentDay )
return nil
CALENDAR2 DIALOG DISCARDABLE 0, 0, 300, 200
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "Testing"
FONT 8, "Microsoft Sans Serif"
BEGIN
CONTROL "",2010,"SysMonthCal32",WS_CHILD |WS_TABSTOP |WS_VISIBLE|MCS_DAYSTATE , 10,30,169,100
END
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 40 guests