forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sample calendar control

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Apr 19, 2006 10:24 am    Post subject: Sample calendar control Reply with quote

I have been asked to provide some sample code for a calendar (date picker) control.
I am posting it here because it may be of general interest.
You can use three files.

The first called resource.rc contains....

#include <windows.h>
#define IDD_DIALOG1 100
#define IDC_EDIT1 201
#define IDC_EDIT2 202
#define IDC_EDIT3 203
#define IDC_MONTHCALENDAR1 1000

#define MCS_DAYSTATE 0x0001
#define MCS_WEEKNUMBERS 0x0004
#define MCS_NOTODAYCIRCLE 0x0008
#define MCS_NOTODAY 0x0010

IDD_DIALOG1 DIALOGEX 0, 0, 115, 106
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Calendar Control"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_MONTHCALENDAR1,"SysMonthCal32",MCS_NOTODAY | WS_TABSTOP,0,0,115,89
EDITTEXT IDC_EDIT1,12,90,28,12,ES_CENTER
EDITTEXT IDC_EDIT2,43,90,28,12,ES_CENTER
EDITTEXT IDC_EDIT3,74,90,28,12,ES_CENTER
END

The second, called calendar.f90 contains....

WINAPP
PROGRAM main
INTEGER,PARAMETER::IDD_DIALOG1 = 100
INTEGER,PARAMETER::IDC_EDIT1 = 201
INTEGER,PARAMETER::IDC_EDIT2 = 202
INTEGER,PARAMETER::IDC_EDIT3 = 203
INTEGER,PARAMETER::IDC_MONTHCALENDAR1 = 1000

INTEGER i,winio@,cb
EXTERNAL cb
COMMON idata(Cool
i=winio@("%di&",IDD_DIALOG1)
i=winio@("%^mc&",IDC_MONTHCALENDAR1,idata,cb)
i=winio@("%`rd&",IDC_EDIT3,idata(1))
i=winio@("%`rd&",IDC_EDIT2,idata(2))
i=winio@("%`rd", IDC_EDIT1,idata(4))
END

INTEGER FUNCTION cb()
COMMON idata(Cool
CALL window_update@(idata(1))
CALL window_update@(idata(2))
CALL window_update@(idata(4))
cb = 2
END

The last file is a batch file to do the compilation, linking and running (call it build.bat say)...

ftn95 calendar.f90
src resource.rc
slink calendar.obj resource.obj
calendar.exe

When you run the batch file from a command prompt, the result displays a calendar control with the edit boxes showing the date values generated in the integer array when a date is selected.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group