Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Operating System Utilities /
Chapter 4 - Date, Time, and Measurement Utilities / Date, Time, and Measurement Utilities Reference
Data Structures


The Toggle Parameter Block

The ToggleDate function exchanges information with your application using the toggle parameter block, defined by the TogglePB data type.

TYPE TogglePB =
RECORD
   togFlags:      LongInt;    {flags}
   amChars:       ResType;    {A.M. characters from 'itl0' }
                              { resource, but made uppercase}
   pmChars:       ResType;    {P.M. characters from 'itl0' }
                              { resource, but made uppercase}
   reserved:      ARRAY[0..3] OF LongInt; {reserved}
END;
Field Description
togFlags
The high-order word of this field contains flags that specify special conditions for the ToggleDate function:

               genCdevRangeBit   = 27;    {restrict date/time to }
                                          { range used by }
                                          { General Controls }
                                          { control panel}
               togDelta12HourBit = 28;    {if modifying hour }
                                          { up/down, restrict to }
                                          { 12-hour range}
               togCharZCycleBit  = 29;    {modifier for }
                                          { togChar12HourBit to }
                                          { accept hours }
                                          { 0...11 only}
               togChar12HourBit     = 30; {if modifying hour by }
                                          { char, accept hours }
                                          { 1...12 only}
               smallDateBit         = 31; {restrict valid }
                                          { date/time to }
                                          { range of Time global}
genCdevRangeBit
If this bit is set in addition to smallDateBit, then the date range is restricted to that used by the General Controls control panel--January 1, 1920 to December 31, 2019 in the Gregorian calendar (the routine works correctly for other calendars as well). For dates outside this range but within the range specified by the system global variable Time--January 1, 1904 to February 6, 2040 in the Gregorian calendar--ToggleDate adds or subtracts 100 years to bring the dates into the range of the General Controls control panel if these bits are set. The ToggleDate function returns an error if the smallDateBit is set and the date is outside the range specified by the system global variable Time. This bit works with system software version 6.0.4 and later.

togDelta12HourBit
If this bit is set, modifying the hour up or down is limited to a 12-hour range. For example, increasing by one from 11 produces 0, increasing by one from 23 produces 12, and so on. This bit works with system software version 6.0.4 and later.
togCharZCycleBit
If this bit is set, the input character is treated as if it modifies an hour whose value is in the range 0-11. If this bit is not set, the input character is treated as if it modifies an hour whose value is in the range 12, 1-11. This bit works with system software version 6.0.4 and later.
togChar12HourBit
If this bit is set, modifying the hour by character is limited to the 12-hour range defined by togCharZCycleBit, mapped to the appropriate half of the 24-hour range, as determined by the pm field. This bit works with system software version 6.0.4 and later.
smallDateBit
If this bit is set, the valid date and time are restricted to the range of the system global variable Time--that is, between midnight on January 1, 1904 and 6:28:15 A.M. on February 6, 2040.
The low-order word of this field contains masks representing fields to be checked by the ValidDate function. Each mask corresponds to a value in the enumerated type LongDateField. You can set this field to check the era through second fields by using the predeclared constant dateStdMask. The following constants specify the LongDateRec fields for the ValidDate function to check.
               CONST
               eraMask              = $0001;    {verify the era}
               yearMask             = $0002;    {verify the year}
               monthMask            = $0004;    {verify the month}
               dayMask              = $0008;    {verify the day}
               hourMask             = $0010;    {verify the hour}
               minuteMask           = $0020;    {verify the }
                                                { minute}
               secondMask           = $0040;    {verify the }
                                                { second}
               dateStdMask          = $007F;    {verify the era }
                                                { through second}
               dayOfWeekMask        = $0080;    {verify the day }
                                                { of the week}
               dayOfYearMask        = $0100;    {verify the day }
                                                { of the year}
               weekOfYearMask       = $0200;    {verify the week }
                                                { of the year}
               pmMask               = $0400;    {verify the }
                                                { evening (P.M.)}
amChars
The trailing string to display for morning (for example, A.M.). This string is read from the numeric-format resource (resource type 'itl0') of the current script system.
pmChars
The trailing to display for evening (for example, P.M.). This string is read from the numeric-format resource (resource type 'itl0') of the current script system.
reserved
Reserved. Set each of the three elements of this field to 0.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996