home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / calend3.zip / CALENDAR.DOC next >
Text File  |  1993-06-10  |  10KB  |  168 lines

  1.  
  2.   Function Calendar( dStartDate, nTRow, nLCol, cColorStr)
  3.   Version: 2.0
  4.  
  5.  
  6.   By:   Rod Cushman
  7.     4773 S. Breton Ct. S.E.  #213
  8.     Kentwood, MI  49508
  9.         (616) 554-9563
  10.  
  11.         CIS #: 71212,1243
  12.  
  13.         June 10, 1993
  14.  
  15. <<=====================================================================>>
  16. << NOTE:                                                               >>
  17. <<      The Calendar function was derived from a program submitted by: >>
  18. <<      JP Steffen                      Compuserve: 76525,262          >>
  19. <<      Leadership Data Services        Telephone:  515-266-0975       >>
  20. <<      725 Grandview                                                  >>
  21. <<      Des Moines, Iowa 50316                                         >>
  22. <<                                                                     >>
  23. <<      December 31, 1990                                              >>
  24. <<                                                                     >>
  25. <<      I have made several major changes to the source code; but I    >>
  26. <<      would like to thank Mr. Steffen for his original work; it      >>
  27. <<      provided a nice starting point.                                >>
  28. <<                                                                     >>
  29. << I have contacted JP Steffen regarding any legality w/regards to     >>
  30. << program; with full clearance.                                       >>
  31. <<                                                                     >>
  32. << The following text was originally supplied with the Calendar        >>  
  33. << function.                                                           >>
  34. <<                                                                     >>
  35. > Perhaps you have been struggling like I have, trying to               <
  36. > learn all the great new features in Clipper 5.0.  Well, I decided to  <
  37. > create this calendar function as a good way jump in to the language   <
  38. > enhancements.                                                         <
  39. >                                                                       <
  40. > This function allows you to pop-up a monthly calendar, roll to a new  <
  41. > month or year, using ENTER to select an output date. You should be    <
  42. > able to build a scheduling system using this function.                <
  43. >                                                                       <
  44. >                                                                      <
  45. >       Moves Cursor to a new date                                    <
  46. >                                                                      <
  47. >                                                                       <
  48. >    Page-Up         Calendar for 30 days ago                           <
  49. >    Page-Down       Calendar 30 days hence                             <
  50. >    Cntr-Page-Up    Calendar for 365 days ago                          <
  51. >    Cntr-Page-Down  Calendar 365 days hence                            <
  52. >                                                                       <
  53. > The color and screen location is configured by parameter passing.     <
  54. >                                                                       <
  55. > Your encouraged to modify and improve this code.  Please contact me   <
  56. > (76525,262) with your comments & suggestions.                         <
  57. >                                                                       <
  58. > If you configured Clipper 5.0 according to Nantucket's installation   <
  59. > the CLIPCAL.BAT file should compile & link the program TEST_CAL.PRG.  <
  60. > Or you can compile calendar.prg as a standalone with the /n parameter.<
  61. >                                                                       <
  62. >                               Happy New Year!                         <
  63. >                               JP Steffen                              <
  64. >                               Leadership Data Services                <
  65. <<=====================================================================>>
  66.  
  67. I have since modified the functionality of Mr. Steffen's program 
  68. according to the following:
  69.  
  70.  1)     The original program painted a rather large calendar on the 
  71.         screen; I have since shrunk the size of this box so that it does 
  72.         not cover so much acreage.
  73.  
  74.  2)     The original code did not do any parameter verification; 
  75.         parameters now default to the 
  76.                 dStartDate  :  Current Date()
  77.                 nTRow       :  MaxRow() -  7
  78.                 nLCol       :  MaxCol() - 23
  79.                 cColorStr   :  current color
  80.  
  81.  3)     Function saves and restores current background screen, color, 
  82.         and Scoreboard status.
  83.  
  84.  4)     Function allows the user to select any year from 0100 ad to 
  85.         2199 ad.  This is either via the cursor, PgUp or PgDn, or the 
  86.         Alt-Y (Get Year) keys.  Upon return from the Alt-Y pop-up box, 
  87.         the calendar displays the current month and date for the 
  88.         selected year.  Function will detect when the window is out of 
  89.         display coordinates and automatically adjust the window back within 
  90.         constraints (via calls to MaxRow(), MaxCol()).
  91.  
  92.  5)     Function allows the user to select any month via the Alt-M (Get 
  93.         Month) key.  The function defaults to the current month 
  94.         selected.  Upon month selection the calendar displays the 
  95.         selected month.  Function will detect when the window is out of 
  96.         display coordinates and automatically adjust the window back within 
  97.         constraints (via calls to MaxRow(), MaxCol()).  If the date 
  98.         adjustment is not within the month's maximum days, the date will be 
  99.         reset to the first of the given month.
  100.  
  101.  6)     Improved functionality of MoveMonth() function; original code 
  102.         added/subtracted 30 days from the current date.  Now the 
  103.         function takes into account the length of the month.  In most 
  104.         cases, the user is displayed the same day of the month when 
  105.         scrolling through dates via the Alt-M, Alt-Y, Ctrl-PgUp, 
  106.         Ctrl-PgDn, and PgUp, PgDn keys.
  107.  
  108.  7)     Modified functionality of Home, End keys.  Prior version of program 
  109.         used the Home and End keys to scroll diagonally, regardless of 
  110.         diagonal value. Current version now uses the Home (K_HOME) to 
  111.         revert to the first day of the current month.  The End (K_END) key 
  112.         progresses to the last day of the current month.
  113.  
  114.  8)     I have revised the sample program called Test_Cal.prg which 
  115.         displays the calendar in the user selected color and position.  
  116.         Also, a view of the source code will show a sample usage of the
  117.         calendar for @ x,y Get <var> Valid Calendar(...).  The sample 
  118.         program testtime() was written for a friend who needed the ending 
  119.         date of the date range to be greater than or equal to the beginning 
  120.         date.  The validation logic of testtime.prg reflects this option.
  121.  
  122.  9)     I have included new function key definitions: Ctrl-Home goes to 
  123.         first day of the current year. Ctrl-End goes to the last day of the 
  124.         current year.  Home goes to the first day of the current month.  
  125.         End goes to the last day of the current month.
  126.  
  127. 10)     The new set of valid key exceptions for the calendar program are 
  128.         the following:
  129.  
  130.                         
  131.                           Moves Cursor to a new date
  132.                         
  133.                    
  134.                        Page-Up         Calendar for previous month
  135.                        Page-Down       Calendar for succeeding month
  136.                        Ctrl-Page-Up    Calendar for 365 days ago
  137.                        Ctrl-Page-Down  Calendar 365 days hence
  138.                        Alt-M           Pop-up month selector
  139.                        Alt-Y           Pop-up year selector (0100 - 2199)
  140.                        Home            Revert to first day of current month
  141.                        End             Go to last day of the current month
  142.                        Ctrl-Home       Revert to first day of current year
  143.                        Ctrl-End        Go to last day of the current year
  144.                        Esc             Return original value passed to the 
  145.                                        calendar function.
  146.                        Space           Return Blank Date ( CtoD(Space(8)) )
  147.  
  148. 11)     I have included sample programs for usage of the calendar program.  
  149.         They are meant as examples; hope they help.  The names of the test
  150.         programs are: TEST_CAL.PRG, TEST_TIME.PRG and TEST_DATE.PRG.  All
  151.         three use the calendar function for date validation and selection.
  152.  
  153. 12)     DISCLAIMER:  Please feel free to make revisions to the source.  I 
  154.         would appreciate any comments or suggestions.  The code has some
  155.         possibility; especially with the use of tbrowse colors for weekends, 
  156.         holidays, etc.  The code is provided 'AS-IS' with no guarantees or 
  157.         warranties.
  158.  
  159. Revision History:
  160.         April 19, 1992  Rod     Submitted onto CompuServe original version.
  161.         May 25, 1993    Rod     Fixed anomally with the 'Alt-M' function;
  162.                                 now checks validity of new date.
  163.         June 10, 1993   Rod     Fixed anomally with the Page-Up, Page-Down
  164.                                 commands; keys will now skip to same day (if 
  165.                                 possible) on the prior/next month.
  166.         June 10, 1993   Rod     Revised documentation and uploaded onto 
  167.                                 PD/Shareware.
  168.