Release 1.0 Copyright ©1994 by Hugh Ashton, Furuike Systems. All Rights Reserved.
MiscDateView |
Inherits From: | View : Responder : Object | |
Declared In: | misckit/MiscDateView.h |
Class Description |
MiscDateView is a palette-loadable object which contains a number of fields and button
controls. It is specifically intended for the entry and validation of dates. No parameters are
settable in the interface object, therefore no InterfaceInspector for this class has been written.
The three editable/selectable text fields are used for entry of year, month, and date, in numeric form. Year -> Month -> Day fields are nextText objects (i.e. the user can tab between them). Pressing Return or Enter at any point in the sequence validates the date (provided fields are filled). Valid dates are from 1901 through 2050. Leap years are taken into account. The non-selectable, non-editable field to the right of the three entry fields is used to display the day of the week. It is also accessible through the calling program. By each editable field are two buttons, used to decrement and increment the values (if any) displayed in the editable fields. Date validation is performed after each button press.
See also: Button, TextField |
Instance Variables |
id day; id dayDown; id dayUp; id dow; id month; id monthDown; id monthUp; id year; id yearDown; id yearUp; |
day | The TextField containing the numerical day value. | |
dayUp | The button incrementing the value in the day field. | |
dayDown | The button decrementing the value in the day field. | |
dow | The TextField containing the alphabetic representation of the day of the week. | |
month | The TextField containing the numerical month value. | |
monthUp | The button incrementing the value in the month field. | |
monthDown | The button decrementing the value in the month field. | |
year | The TextField containing the numerical year value. | |
yearUp | The button incrementing the value in the year field. | |
yearDown | The button decrementing the value in the year field. |
Method Types |
Initializing a DateView | - initFrame: | |
Setting the date | - getTodaysDate: - decDay: - decMonth: - decYear: - incDay: - incMonth: - incYear: - outputDOW: | |
Date checking | - isDateValid: |
- isItaLeapYear: - whatDayIs::: - checkDay: - getDay: - getMonth: - getYear: |
Displaying | - drawSelf:: | |
Archiving | - read: |
- write: |
Instance Methods |
checkDay: |
- checkDay:sender |
Checks the validity of the values entered in the MiscDateView and checks the day of the week,
by calling the whatDayIs::: and isDateValid: methods. If any of the fields are blank, dow is
filled with "XX". Always returns self. See also: - whatDayIs:::, -isDateValid: decDay: |
- decDay:sender |
Decrements the value of the number field (if any) in the day field. Date checking ensures that
the other fields are also updated. Always returns self. See also: - decMonth:, - decYear:, - incDay:, - incMonth:, - incYear: decMonth: |
- decMonth:sender |
Decrements the value of the number field (if any) in the month field. Date checking ensures
that the other fields are also updated. Always returns self. See also: - decDay:, - decYear:, - incDay:, - incMonth:, - incYear: decYear: |
- decYear:sender |
Decrements the value of the number field (if any) in the day field. Date checking ensures that
the other fields are also updated. Always returns self. See also: - decDay:, - decMonth:, - incDay:, - incMonth:, - incYear: drawSelf:: |
- decDay:(const NXRect *)rects :(int)rectCount |
Draws the MiscDateView. Always returns self.
getDay: |
- (int)getDay:sender |
Returns the integer value of the number field (if any) in the day field. See also: - getMonth:, - getYear: getMonth: |
- (int)getMonth:sender |
Returns the integer value of the number field (if any) in the month field. See also: - getDay:, - getYear:
getTodaysDate: |
- getTodaysDate:sender |
Takes the date from the system, parses it, converts to numbers (where necessary) and fills the
appropriate fields. dow is filled directly from the system call, not calculated. Always returns
self.
getYear: |
- (int)getYear:sender |
Returns the integer value of the number field (if any) in the year field. See also: - getDay:, - getMonth:
incDay: |
- incDay:sender |
Increments the value of the number field (if any) in the day field. Date checking ensures that the
other fields are also updated. Always returns self. See also: - decDay:, decMonth:, - decYear:, - incMonth:, - incYear: incMonth: |
- incMonth:sender |
Increments the value of the number field (if any) in the month field. Date checking ensures that
the other fields are also updated. Always returns self. See also: - decDay:, decMonth:, - decYear:, - incDay:, - incYear: incYear: |
- incYear:sender |
Increments the value of the number field (if any) in the year field. Date checking ensures that
the other fields are also updated. Always returns self. See also: - decDay:, decMonth:, - decYear:, - incDay:, - incMonth:
initFrame: |
- initFrame:(const NXRect *)frameRect |
Initializes the MiscDateView instance. This should not be called by the user, as MiscDateView
is intended as a palette object. Returns self.
isDateValid: |
- (BOOL)isDateValid:sender |
Checks for the validity of the values entered in the MiscDateView day, month and year fields
(if any) and responds with an appropriate alert panel if they are not. Returns NO on invalidity,
else YES.
isItaLeapYear: |
- (BOOL)isItaLeapYear:(int)year |
Checks if the integer passed is divisible by 4 (i.e. a leap year). Since the object only checks
dates between 1901 through 2050, no real sophistication is embedded here. Returns NO on
non-leap years, else YES.
outputDOW: |
- outputDOW:(unsigned int)number |
Takes an integer expressing the number of days since 1 January 1901, and outputs (using an
internal lookup table) a 3-character abbreviation of the day of the week to dow. Returns self.
read: |
- read:(NXTypedStream *)stream |
Reads the MiscDateView from the typed stream stream. Returns self.
See also: - write:
whatDayIs::: |
- (unsigned int)whatDayIs:(int)theDay :(int)theMonth :(int)theYear |
Takes three values, with no checking except for year (this checking is the user's responsibility),
and returns an integer value representing the number of days since 1 January 1901.
write: |
- write:(NXTypedStream *)stream |
Writes the receiving MiscDateView to the typed stream stream. Returns self.
See also: - read: |