home *** CD-ROM | disk | FTP | other *** search
/ ftp.alaska-software.com / 2014.06.ftp.alaska-software.com.tar / ftp.alaska-software.com / acsn / ClickDate.txt < prev    next >
Text File  |  2002-10-27  |  7KB  |  154 lines

  1. ***********************************************************************
  2. *
  3. *  Module:     ClickDate.prg       Rev 1.41  17th.Oct.2002
  4. *  Category:   Program, Calendar
  5. *
  6. *  Purpose:    To provide a date selection solution satisfying the
  7. *              return requirements for a date Get or Sle field, or a
  8. *              date variable.
  9. *
  10. *  Author:     Greg Doran, Dublin Ireland
  11. *
  12. ***********************************************************************
  13. *
  14. *  Copyright (c) Greg J Doran. 2001-2002   e-mail: GDO@eircom.net
  15. *
  16. *  This code is released under the GNU General Public Licence
  17. *  and is governed by the conditions and protocols setout therein.
  18. *
  19. *  The code is provided "as is", without warranty of any kind,
  20. *  either expressed, or implied, including, but not limited to,
  21. *  the implied warranties of merchantability and fitness for a
  22. *  particular purpose. The entire risk as to the quality of this
  23. *  software, its use or misuse, modified or otherwise, lies with
  24. *  you, the recipient.
  25. *
  26. ***********************************************************************
  27. *
  28. *  Syntax:  ClickDate(xDate,oOwner,oDateField)
  29. *
  30. *           xDate can either be Text as in CtoD(date()) or a
  31. *           dDate value or may be omitted altogether.
  32. *  Usage:
  33. *
  34. *           Return a date to a Date Variable;
  35. *           ---------------------------------
  36. *           dDate:= ClickDate([<xDate>],oOwner)
  37. *
  38. *           Return a date to a date get field;
  39. *           ------------------------------------
  40. *           oGet:lbDblClick := {| MP1, uNIL, o| clickdate(o:editbuffer(),oDlg,@o)}
  41. *
  42. *           Return a date to a date Sle field;
  43. *           ------------------------------------
  44. *           oSle:lbDblClick := {| MP1, uNIL, o| clickdate(o:editbuffer(),oDlg,@o)}
  45. *
  46. *           Top-Down user's Note:
  47. *           =====================
  48. *           You may use Clickdate in a bWhen codeblock in a tdDEget().
  49. *           It sets o:editbuffer() and returns the logic value .T.
  50. *           bWhen:= {|o| clickdate(o:editbuffer(),oDlg,@o)}
  51. *           If the get is the only active edit field on the form you
  52. *           can only activate the calendar once using a bWhen.
  53. *           (You can't re-trigger the bWhen without exiting the get
  54. *            and re-entering.)
  55. *
  56. *  Date:    ClickDate will accept invalid data from an Sle edit buffer
  57. *           and ignore the input.  It will return a valid date if one
  58. *           is selected, otherwise on Escape or Close [X] it will
  59. *           set the Sle edit buffer to "  /  /  ".
  60. *
  61. *           If the input is Character, clickDate performs a validation check
  62. *           on the data input and uses "  /  /  " if it is invalid.
  63. *
  64. *           Both the Sle and Get are treated identically even though the
  65. *           editbuffer content is cText in one case and a dDate in the other.
  66. *           The ClickDate code accepts either, and sets the o:editbuffer()
  67. *           with the appropriate VarType on selection.
  68. *
  69. *           The date (or empty buffer content) is sent to Clickdate when the
  70. *           Sle or Get is DoubleClicked. this means you can edit the field
  71. *           locally without the Calendar activating.
  72. *
  73. *  Owner:   Because Clickdate() is using a Modal dialog it is desireable that
  74. *           you nominate the calling dialog (oDlg) as the Owner of the ClickDate
  75. *           modal dialog, particularily if it is itself a Modal.
  76. *
  77. *           Do not use a Groupbox or Static or DrawingArea as the owner, it must
  78. *           be the Dialog.  Sure, it will work if you don't nominate the calling
  79. *           oDlg, but you risk a problem arising and unpredictability.
  80. *           Anything from the user being able to click the Get/Sle field a
  81. *           second time while the calendar is active to a total system freeze.
  82. *           This is not a problem with ClickDate, if you don't handle Modal's
  83. *           properly you invite trouble.
  84. *
  85. * oDateField:
  86. *           For a Get or Sle the Get or Sle object must be passed by
  87. *           reference.  There is minimal checking in this regard so if
  88. *           you pass a non-Get/Sle oVar you will definitely get an error.
  89. *
  90. *
  91. ***********************************************************************
  92. *
  93. *  Picture Keys:
  94. *  =============
  95. *  [-]  Minimise, just drops to Icon on bottom left of screen.
  96. *  [x]  Close without section
  97. *  [8]  Little calendar -  returns/moves to Todays date.
  98. *  [/]  Tick mark - Select this date and exit.
  99. *  [C]  Open circular arrow - 'undo' return to orginal date on entry
  100. *  [?]  Help key, when activated has a / through it (toggle).
  101. *
  102. *
  103. ************************************************************************
  104. *
  105. *
  106. *  Configuration:
  107. *  ==============
  108. *
  109. *  The Calendar is fully configurable to use multiple languages and or
  110. *  background colours / bitmaps.  See important note below.
  111. *
  112. *  The current default is English.  The only difference between English
  113. *  and US-English is the date formatting.   The routine operates using
  114. *  the Set Date British format and switches the returned value to the
  115. *  locale set in ClickDate.ch. Do not change the British format in the
  116. *  routine, unless of course you want to give yourself unnecessary
  117. *  work going through the entire routine making changes where appropriate.
  118. *
  119. *  Not being an expert in languages, not even my native language!,
  120. *  the addition of other languages is entirely up to you.  The
  121. *  ClickDate.ch file has a template for you to customise the calendar
  122. *  to the language of your choice.
  123. *
  124. **********************************************************************
  125. *
  126. *  IMPORTANT
  127. *  =========
  128. *  ENTER YOUR LANGUAGE DEFINITIONS IN ClickDate.ch and...
  129. *  IN ClickDate.PRG make changes as follows:
  130. *
  131. *  AFTER:
  132. *  ------
  133. *  #include "xbp.ch"
  134. *  #include "Appevent.ch"
  135. *  #include "Gra.ch"
  136. *  #include "common.ch"
  137. *  #include "dll.ch"
  138. *
  139. *  AND BEFORE #INCLUDE CLICKDATE.CH
  140. *  --------------------------------
  141. *  ACTIVATE YOUR LANGUAGE DEFINITION DEFINED IN CLICKDATE.CH
  142. *  ----------------------------------------------------------
  143. *  // #define USENGLISH  // USEnglish
  144. *  #define ENGLISH
  145. *  // define LANGUAGE:  GERMAN, SPANISH, ITALIAN, PORTUGUESE etc.
  146. *
  147. * ================================================================
  148. *  NOTE:  ClickDate.CH MUST _FOLLOW_ YOUR LANGUAGE DEFINITION
  149. * ================================================================
  150. *  #include "ClickDate.ch"
  151. *
  152. **********************************************************************
  153.  
  154.