home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-16 | 5.0 KB | 124 lines | [TEXT/KAHL] |
- /***************************************************************************
-
- Date & Time CDEF v1.1.1
- by Michael F. Kamprath
-
- ©1993 by Michael F. Kamprath
-
-
- Requirments:
- ============
-
- This CDEF can only be used with system 7.0 or later. This is because
- this CDEF uses System 7's Color Icon family manager.
-
- Description
- ===========
-
- This CDEF will allow your program to use a point and click method for entering
- dates and/or times into your program. (It will not, however, allow keyed
- entering of dates.) This CDEF uses the control record's hilite, value, and
- refcon fields to manage what the current date value is, which part is hilited,
- and if the "up/down" button is active. How the fields are used is as follows:
-
- (*theControl)->contrlHilite = Control active (=0) or inactive (=255)
- (also used to determine what part of the
- up/down arrow is to be hilited during
- tracking, but this is internal to the CDEF).
- (*theControl)->contrlValue = Determines which part of the date or time string
- (depending on variation code) is to be hilited.
- If it is nonzero, the the up/down arrow is
- active and detects mouse clicks, otherwise
- the up/down arrow is inactive (but drawn if
- the hilite is not 255)
- (*theControl)->contrlRfCon = Contains a _pointer_ to the DateTimeRec to be
- controled.
-
- This CDEF has two variations, one for time control (varCode=kTimeVariation), and
- one for date control (varCode=kDateVariation). Both variations use the current
- system setting for date and time display (except leading zeros are forced on all
- numeric fields).
-
- The basic scheme for using this CDEF is as follows:
-
- 1. #include "DateTimeCDEF.h" in your code.
-
- 2. Initialize the control. A typical initialization would be:
-
- hCtl = NewControl( theWindow, &ctrlRect, title, visible,
- initialValue=0, min=0, max=128,
- CDEF_ID*16 + varCode, refCon );
-
- It's rect should be about 175(long)x20(high) - fine
- tune this value for your own application. Also place the pointer to it's
- refcon field (either at initialization with NewControl() or ASAP with
- GetNewControl() ). If you want to control both the time and date to a single
- DateTimeRec, put it's point in both the time and date variation controls.
-
- 3. When a mouse down occurs within the control, track it as usual. Then
- if the returned part code is nonzero, do:
-
- If ( partcode != kArrowButtonUp) && ( partcode != kArrowButtonDown )
- ==> Set the control value to the partcode returned.
- Else
- ==> If (control value != zero)
- ==> Increment or decrement the DateTimeRec according to
- the partCode returned.
- Else
- ==> Impossible case.
-
- 4. Upon activation or deactivation of the window (or even control), be
- sure to set the -control hilite to either 0 or 255 (as per the situation
- requires).
-
- 5. When disposing the control, don't forget to dispoae the pointer to the
- DateTimeRec (that is, if you allocated a memory block for it rather than
- using a stack variable).
-
- If this confuses you, be sure to check out the code for the "CDEF Sampler"
- program included with this package.
-
- NOTE: The icon id for the up/down arrow is hard coded into the CDEF at
- 15000. You can change the icon supplied with this CDEF, but remember it
- should be a 16x16 icon family (ics#), and that the top half is considered
- the up button, and the bottom half is the down button. Notice that
- icon #15001 represents the "up button depressed" icon, and #15002 represents
- the "down button depressed" icon. All of these (15000-15002) icons must
- be defined for the CDEF to work properly.
-
- Shareware Info:
- ===============
-
- If you use this CDEF for personal use, all I ask is that you send me a note
- and maybe a copy of the program you use it in.
-
- If you use this CDEF for somethiong that you later charge money for (like
- your own shareware software or commercial software), the price for it's use
- is a one time payment of $5 and maybe a copy of your program. If you don't
- wish to give me a free copy of your program, I understand (after all, I'm
- asking for money).
-
- If you wish for the source code to this CDEF, I will send it to you if you
- include a disk with your shareware payment ($5). I will not send the source
- code out with out the shareware payment or the disk (though I will send it
- via e-mail if you send me the shareware payment before I lose my e-mail
- account).
-
- Please make all payments in U.S. funds.
-
- You may contact me by:
-
- e-mail: kamprath@aol.com
-
- postal mail: Michael F. Kamprath
- 524 Avenue C
- Redondo Beach, CA 90277
-
- Legal Stuff
- ===========
-
- I provide no warranty, written or implied, nor do I accept any responsibility
- for damages inflicted, real or imagined, by the use of this CDEF.
-
-
- ***************************************************************************/