This is a basic calendar that presents one month at a time in a standard Paradox 4.0 dialog box. The user can use [Pgup/PgDn] to change months, [CtrlPgUp/CtrlPgDn] to change years, or select the [Month] pushbutton for a Month sub-dialog box or a Year sub-dialog box by pushing the [Year] button on the main calendar. The Year sub-dialog box allows the user to change years with the [PgUp/PgDn] keys, or by typing in the new year.
The Calendar allows the user to select a day of the month, from 100 A.D. to 9999 A.D. If the user selects a date from the calendar, then the Calendar.Dialog() returns true, otherwise it returns false. If Calendar.Dialog returns true, then the selected date can be picked up from the property Calendar.Date. To override the default date (today()) set the property Calendar.Date before calling Calendar.Dialog().
The default bahavior will place a selected date in a date field or in a memo if the workspace is in "Edit" or "CoEdit" mode.
Alternatively, you can load procedures from the Calendar.sc script at the beginning of your application like this:
Librarian.HasControl = True
Play "Calendar"
Release Vars Librarian.HasControl
You can then call Calendar.Constructor() , Calendar.Dialog(), and Calendar.Constructor() according to the documentation below. Or you can just call Calendar.Show() to get the default behavior described in the first option.
As a third alternative, you can write all the procedures in Calendar.sc to a library, and handle them accordingly.
Usage: Issue Calendar.Constructor() at the beginning of the session with Calendar, or at the beginning of your application. If Calendar.Constructor() is called once at the beginning of your application, then each time the user views the Calendar, he or she will see the date that was selected the last time the Calendar was used.
------
Calendar.Destructor()
Syntax: Calendar.Destructor()
Returns: Nothing.
Description: Destroys Calendar in memory.
Usage: Call Calendar.Destructor() at the end of the Calendar session if Calendar.Constructor() was called at the beginning of the Calendar session, or call Calendar.Destructor() at the end of your application if Calendar.Constuctor() was called at the beginning of your application.
------
Calendar.Dialog()
Syntax: Calendar.Dialog()
Returns: True if the user selected a date, otherwise returns false. If it returns true, then as a side effect Calendar.Date is set to the date the user selected.
Description: Displays the Calendar and waits for user input.
Usage: Issue Calendar.Dialog() when you want to display the calendar to the user, after issuing Calendar.Constructor() and before issuing Calendar.Destructor().
Example:
Calendar.Constructor() ; create the Calendar
If Calendar.Dialog() Then ; user has selected a date
[] = Calendar.Date ; place date in date field
Endif
Calendar.Destructor() ; destroy the Calendar
Properties:
-----------
Alter properties after Calendar.Constructor() call and before Calendar.Dialog() call.
------
Calendar.Date
Data type: Date
Description: The date. Overrides default if set before Calendar.Dialog(), and contains the selected date if Calendar.Dialog() returns true.
------
Calendar.DisplayTime
Data type: Logical
Description: If true, displays time (with annoying cursor flicker if the cursor is on the PickArray) otherwise doesn't display time.
------
Calendar.ColorBag[]
Data type: Dynarray
Description: assign colors by Window SetColors convention
------
Calendar.FrameShadow
Data type: Numeric, color attribute
Description: The color for the dark sides of the raised frames
------
Calendar.FrameHighlight
Data type: Numeric, color attribute
Description: The color for the light sides of the raised frames
------
Calendar.WindowBag[]
Data type: Dunarray
Description: assign attributes by Window SetAttributes convention
-------
Analagous properties for the sub-dialogs...
Calendar.YearColorBag[]
Calendar.YearFrameShadow
Calendar.YearFrameHighlight
Calendar.YearWindowBag[]
Calendar.MonthColorBag[]
Calendar.MonthFrameShadow
Calendar.MonthFrameHighlight
Calendar.MonthWindowBag[]
------
Calendar.IsActive
Data type: Logical
Description: (readonly) indicates if Calendar.Constructor() has been run. Use IsAssigned(Calendar.IsActive) to test existence of the Calendar.