Error : Calendar Control
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Error : Calendar Control
The following lines were used in a sample to highlight dates ( from a database ).
OnGetState( oCal, aDates )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, aDates ) }
SetDayState() results in an unrecoverable error 9023: hb_xgrab requested to allocate zero bytes. There are 23 elements in the array aDates, and at least two are for the month being displayed.
Looking at the code for OnGetState( oCal, aDates ), however, I think there may be an error:
METHOD SetArrayDayState( nMonth, nDay ) is looking for the actual month, but in the function provided, that value is always 1
oCal:SetArrayDayState( 1, Day( aDates[ i ] ) )
I would love to get this working. The code to which I'm referring was in the previous post on the Calendar implementation in 10.4.
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=18690&p=97977&hilit=calendar#p97977
Thanks for any suggestions !
OnGetState( oCal, aDates )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, aDates ) }
SetDayState() results in an unrecoverable error 9023: hb_xgrab requested to allocate zero bytes. There are 23 elements in the array aDates, and at least two are for the month being displayed.
Looking at the code for OnGetState( oCal, aDates ), however, I think there may be an error:
METHOD SetArrayDayState( nMonth, nDay ) is looking for the actual month, but in the function provided, that value is always 1
oCal:SetArrayDayState( 1, Day( aDates[ i ] ) )
I would love to get this working. The code to which I'm referring was in the previous post on the Calendar implementation in 10.4.
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=18690&p=97977&hilit=calendar#p97977
Thanks for any suggestions !
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Hello Tim
can you post a self container sample?
thank you
can you post a self container sample?
thank you
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
I think if you look at the link I posted to the previous thread, and the sample you posted toward the end, you will see the code to which I'm referring. Although I plugged it into some more extensive code, everything else is clean until I call the one function I referenced above. If I comment out that call, then there is no problem but of course the dates are not highlighted.
The code I used was:
REDEFINE CALENDAR oCal VAR dDate OF oCalDlg ID 2001 ;
ON CHANGE ( dDate := oCal:GetDate(), ApptFunc( ) )
OnGetState( oCal, aDates )
oCal:SetDayState() // THE ERROR OCCURS WITH THIS CALL
oCal:bOnGetState = { | oCal | OnGetState( oCal, aDates ) }
The code I used was:
REDEFINE CALENDAR oCal VAR dDate OF oCalDlg ID 2001 ;
ON CHANGE ( dDate := oCal:GetDate(), ApptFunc( ) )
OnGetState( oCal, aDates )
oCal:SetDayState() // THE ERROR OCCURS WITH THIS CALL
oCal:bOnGetState = { | oCal | OnGetState( oCal, aDates ) }
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Tim
How do you fill ::aDayState array?
remember if you have 1, 2, 3..., 12 visible months in calendar, the first month visible always will be 1 inside array, example
a calendar with 3 month visible
june, july, august
june = 1
july = 2
august = 3
i mean, the position [1, 20] is june, 20
the position [3, 12] is august, 12
all month for this array will have 31 position (31 days), no matter the months with 28, 29 or 30 days... if you set february 31 inside array, nothing happen
How do you fill ::aDayState array?
remember if you have 1, 2, 3..., 12 visible months in calendar, the first month visible always will be 1 inside array, example
a calendar with 3 month visible
june, july, august
june = 1
july = 2
august = 3
i mean, the position [1, 20] is june, 20
the position [3, 12] is august, 12
all month for this array will have 31 position (31 days), no matter the months with 28, 29 or 30 days... if you set february 31 inside array, nothing happen
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
I have a database of appointments. I filled the array with dates from the individual records. There are 23 records, so 23 items in the array.
I only show one calendar. I'm using it to select the date on which they want to view the appointments. On initialization I assumed it would show the dates highlighted that had appointments.
This is the code for the calendar. The ApptFunc() sets a filter for xbrowse for the date selected on the calendar ( dDate ) to display the appointments on that date. It works fine.
REDEFINE CALENDAR oCal VAR dDate OF oCalDlg ID 2001 ;
ON CHANGE ( dDate := oCal:GetDate(), ApptFunc( ) )
OnGetState( oCal, aDates )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, aDates ) }
Maybe there is something else I'm missing. Except for the error with SetDayState() I have no problems. I am usign xHbarbour commercial with the Pelles C Builder.
I only show one calendar. I'm using it to select the date on which they want to view the appointments. On initialization I assumed it would show the dates highlighted that had appointments.
This is the code for the calendar. The ApptFunc() sets a filter for xbrowse for the date selected on the calendar ( dDate ) to display the appointments on that date. It works fine.
REDEFINE CALENDAR oCal VAR dDate OF oCalDlg ID 2001 ;
ON CHANGE ( dDate := oCal:GetDate(), ApptFunc( ) )
OnGetState( oCal, aDates )
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, aDates ) }
Maybe there is something else I'm missing. Except for the error with SetDayState() I have no problems. I am usign xHbarbour commercial with the Pelles C Builder.
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Tim..
can you post function OnGetState() ??
thanks
can you post function OnGetState() ??
thanks
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
OnGetState is the function in the sample you provided.
Code: Select all | Expand
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
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Tim
please build/run this test
please build/run this test
Code: Select all | Expand
#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
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
That may work but it is a very defined sample. It is different then what you posted for an example on how to highlight a series of dates.
I've been working on trying to figure out where the problem lies. For example, I am using a REDEFINE which is different then the DEFINE example. Not as many options are shown in a redefine. For example, you use DAYSTATE with your control but that cannot be placed in a redefine. Maybe that contributes to the problem ?
What I'm trying to do is to click on a date, and use it to filter the database of appointments. I find that using ON CHANGE is giving me a blank date ( oCal:dDate is returning " / / " in the OnGetState( ) function ).
I'll continue testing today. Any thoughts would be appreciated.
I've been working on trying to figure out where the problem lies. For example, I am using a REDEFINE which is different then the DEFINE example. Not as many options are shown in a redefine. For example, you use DAYSTATE with your control but that cannot be placed in a redefine. Maybe that contributes to the problem ?
What I'm trying to do is to click on a date, and use it to filter the database of appointments. I find that using ON CHANGE is giving me a blank date ( oCal:dDate is returning " / / " in the OnGetState( ) function ).
I'll continue testing today. Any thoughts would be appreciated.
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
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
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
The problem lies in the difference between DEFINE and REDEFINE. When doing a REDEFINE, you do not address the initialization of DAYSTATE. Thus the aDateState is empty and that creates a problem.
For testing, I am using your code sample in a program with an .RC file which is setup accurately. I have modified the control as follows:
LOCAL dDate := DATE()
REDEFINE CALENDAR oCal VAR dDate OF oCalDlg ID 2001
// These calls are not in REDEFINE but are in DEFINE
oCal:lDayState := .T.
oCal:resetDayStates()
// This is your function from the sample and checking nMonth I get a 0
OnGetState( oCal, lSunday, lSaturday )
// The following call gets an "hb_xgrab requested to allocate zero bytes. error message.
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, lSunday, lSaturday ) }
In the OnGetState() call, the following results are shown:
dStartDate = oCal:dDate
imax := Len( oCal:aDayState )
nMonth := Month( dStartDate )
MsgInfo( dStartDate ) // Displays " / / "
MsgInfo( imax ) // Displays 0
MsgInfo( nMonth ) // Displays 0
Your ideas would be appreciated.
For testing, I am using your code sample in a program with an .RC file which is setup accurately. I have modified the control as follows:
LOCAL dDate := DATE()
REDEFINE CALENDAR oCal VAR dDate OF oCalDlg ID 2001
// These calls are not in REDEFINE but are in DEFINE
oCal:lDayState := .T.
oCal:resetDayStates()
// This is your function from the sample and checking nMonth I get a 0
OnGetState( oCal, lSunday, lSaturday )
// The following call gets an "hb_xgrab requested to allocate zero bytes. error message.
oCal:SetDayState()
oCal:bOnGetState = { | oCal | OnGetState( oCal, lSunday, lSaturday ) }
In the OnGetState() call, the following results are shown:
dStartDate = oCal:dDate
imax := Len( oCal:aDayState )
nMonth := Month( dStartDate )
MsgInfo( dStartDate ) // Displays " / / "
MsgInfo( imax ) // Displays 0
MsgInfo( nMonth ) // Displays 0
Your ideas would be appreciated.
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Tim
DAYSTATE is control Style, you should activate in RC/RES file, check MCS_DAYSTATE
DAYSTATE is control Style, you should activate in RC/RES file, check MCS_DAYSTATE
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
Here is a full test .prg for this with a dialog and resource using your sample. Sat and Sun should be in bold but in fact they are not.
// ANd here is the RC file:
Code: Select all | Expand
#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
// ANd here is the RC file:
Code: Select all | Expand
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
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Tim
1. Is not ACTIVATE WINDOW is ACTIVATE DIALOG
2. Delete ACTIVATE WINDOW oWnd2 from Function OnGetState
try with this changes
1. Is not ACTIVATE WINDOW is ACTIVATE DIALOG
2. Delete ACTIVATE WINDOW oWnd2 from Function OnGetState
try with this changes
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
- TimStone
- Posts: 2955
- Joined: Fri Oct 07, 2005 1:45 pm
- Location: Trabuco Canyon, CA USA
- Has thanked: 25 times
- Been thanked: 2 times
- Contact:
Re: Error : Calendar Control
That is not the problem. It actually displayed the window ( dialog ) but the problem is that it does not bold the Saturday and Sunday dates.
There is an additional problem with the code shown above. When it activates, it has the focus date on May 1, not May 19. May 19 is boxed !
There is an additional problem with the code shown above. When it activates, it has the focus date on May 1, not May 19. May 19 is boxed !
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
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
- Daniel Garcia-Gil
- Posts: 2365
- Joined: Wed Nov 02, 2005 11:46 pm
- Location: Isla de Margarita
- Contact:
Re: Error : Calendar Control
Tim...
did you tried my changes?
because, your sample work for me, with the change i told
With Changes
RC File
exe file...
http://www.sitasoft.net/fivewin/samples/timtc.zip
Image
![Image](http://www.sitasoft.net/fivewin/screen/timtestcal.png)
without change
exe file...
http://www.sitasoft.net/fivewin/samples/timtc2.zip
Image
![Image](http://www.sitasoft.net/fivewin/screen/timtestcal2.png)
did you tried my changes?
because, your sample work for me, with the change i told
With Changes
Code: Select all | Expand
#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
RC File
Code: Select all | Expand
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
exe file...
http://www.sitasoft.net/fivewin/samples/timtc.zip
Image
![Image](http://www.sitasoft.net/fivewin/screen/timtestcal.png)
without change
exe file...
http://www.sitasoft.net/fivewin/samples/timtc2.zip
Image
![Image](http://www.sitasoft.net/fivewin/screen/timtestcal2.png)
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9