4

The LA Fox DeveloDer Newsletter
Auaust 1998
Y2K (Con’t from page 1)
Date; Select All on Entry

This textbox date entry class does the following:
1.
Allows blank dates
2.
Invalid dates
2.1
Displays wait window “Invalid date”
- Accepts 02/29/2000, not 02/29/00
2.2
Will not allow dates before 1900 or after 2100
- Resets to blank
3.
Adds 100 years to any date less than 1920
4.
Status bar (while in field)
4.1
Displays date value, with month in words
- Correct order for Windows date setting
- Refreshes on entry of each digit
4.2
Displays “bad date” as appropriate
4.3
Displays message if date < 1900 or >2100
5.
Tool tip
5.1
“Original date: “+date, month in words, while in field
5.2
Date, month in words, after field has been left
* CLASS DateTextBox.InteractlveChangeO

* Author/Date: Judy Denison 06/26/98
a Description: Sets running status bar display
*
Parameters: None
*
Variables:
a
IcDate
Long date; e.g.: June 26, 1998
a
IdDate
Date In date format
* Returns:
None
Uses:
None
a calls: None
*
Called by: None
LOCAL
lcDate, IdDate
STORE” TO
lcDate
STORE 0 TO
IdDate
a Find correct date, referring to rollover year WiTH THIS
IF NOT EMPTY(.Value);
AND YEAR(.Value) < .nRolloverYear
IdDate = GOMONTH(.Value, 1200)
aSE
IdDate = Value
ENDIF
ENDWITH

* Long date In Canadian word order If appropriate a (Canadian settings should be ‘DMY’) IcDate = IIF(SET(’DATE’) = ‘DMY’,;
DMY(IdDate),
MDY(ldDate))
SET MESSAGE TO lcDate

RflURN
a Author/Date: Judy Denison 06/26/98
a Description: Checks for reasonable year; sets to 21st
*
century if before rollover year
* Parameters: None
a Variables: None
*
lcNotify Original setting of SET NOTIFY
a
lnYear
Year of currently entered date
a Returns: .TJ.F.
* Uses:
None
* Calls: None
* Called by: None


LOCAL
lcNotlfy, lnYear
STORE” TO lcNotlfy
STORE 0 TO lnYear WiTH THIS
Get old NOTIFY setting
IcNotify = .cNotify

*0K if empty IF EMPTY(.Value)
.Value = (ll}
a Reset all and leave field
SET MESSAGE TO .ToolTipText SET NOTIFY &lcNotify RETURN .T.

Reset & message if year
* not between 1900 and 2100 lnYear YEAR(.Value)
IF InYear < 1900 OR lnYear> 2100
.Value = (II)
SET MESSAGE TO;
‘Year must be between
+
‘1900 and 2100.’
RETURN .F.
ENDF
Go to 21st century If c Rollover Year
IF lnYear c .nRolloverYear
.Value = GOMONTH(.Value, 1200)
ENDIF

* ToolTip: Long date In Canadian word order
* If appropriate .ToolTipText lIF(SET(’DATE’) = ‘DMY’,;
DMY(.Value),
MDY(.Value))
* Remove status message on leaving field
SET MESSAGE TO
a Restore NOTIFY to original setting
SET NOTIFY &lcNotify
ENDWITH

RETURN.T.

a End: CLASS DateTextBox.Valid()
a End: CLASS DateTextBox.InteractlveChange()
*
CLASS DateTextBox.When()
CLASS DateTextBox.Valid()
(Con’t, page 5)

4