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 >
Wrap
Text File
|
2002-10-27
|
7KB
|
154 lines
***********************************************************************
*
* Module: ClickDate.prg Rev 1.41 17th.Oct.2002
* Category: Program, Calendar
*
* Purpose: To provide a date selection solution satisfying the
* return requirements for a date Get or Sle field, or a
* date variable.
*
* Author: Greg Doran, Dublin Ireland
*
***********************************************************************
*
* Copyright (c) Greg J Doran. 2001-2002 e-mail: GDO@eircom.net
*
* This code is released under the GNU General Public Licence
* and is governed by the conditions and protocols setout therein.
*
* The code is provided "as is", without warranty of any kind,
* either expressed, or implied, including, but not limited to,
* the implied warranties of merchantability and fitness for a
* particular purpose. The entire risk as to the quality of this
* software, its use or misuse, modified or otherwise, lies with
* you, the recipient.
*
***********************************************************************
*
* Syntax: ClickDate(xDate,oOwner,oDateField)
*
* xDate can either be Text as in CtoD(date()) or a
* dDate value or may be omitted altogether.
* Usage:
*
* Return a date to a Date Variable;
* ---------------------------------
* dDate:= ClickDate([<xDate>],oOwner)
*
* Return a date to a date get field;
* ------------------------------------
* oGet:lbDblClick := {| MP1, uNIL, o| clickdate(o:editbuffer(),oDlg,@o)}
*
* Return a date to a date Sle field;
* ------------------------------------
* oSle:lbDblClick := {| MP1, uNIL, o| clickdate(o:editbuffer(),oDlg,@o)}
*
* Top-Down user's Note:
* =====================
* You may use Clickdate in a bWhen codeblock in a tdDEget().
* It sets o:editbuffer() and returns the logic value .T.
* bWhen:= {|o| clickdate(o:editbuffer(),oDlg,@o)}
* If the get is the only active edit field on the form you
* can only activate the calendar once using a bWhen.
* (You can't re-trigger the bWhen without exiting the get
* and re-entering.)
*
* Date: ClickDate will accept invalid data from an Sle edit buffer
* and ignore the input. It will return a valid date if one
* is selected, otherwise on Escape or Close [X] it will
* set the Sle edit buffer to " / / ".
*
* If the input is Character, clickDate performs a validation check
* on the data input and uses " / / " if it is invalid.
*
* Both the Sle and Get are treated identically even though the
* editbuffer content is cText in one case and a dDate in the other.
* The ClickDate code accepts either, and sets the o:editbuffer()
* with the appropriate VarType on selection.
*
* The date (or empty buffer content) is sent to Clickdate when the
* Sle or Get is DoubleClicked. this means you can edit the field
* locally without the Calendar activating.
*
* Owner: Because Clickdate() is using a Modal dialog it is desireable that
* you nominate the calling dialog (oDlg) as the Owner of the ClickDate
* modal dialog, particularily if it is itself a Modal.
*
* Do not use a Groupbox or Static or DrawingArea as the owner, it must
* be the Dialog. Sure, it will work if you don't nominate the calling
* oDlg, but you risk a problem arising and unpredictability.
* Anything from the user being able to click the Get/Sle field a
* second time while the calendar is active to a total system freeze.
* This is not a problem with ClickDate, if you don't handle Modal's
* properly you invite trouble.
*
* oDateField:
* For a Get or Sle the Get or Sle object must be passed by
* reference. There is minimal checking in this regard so if
* you pass a non-Get/Sle oVar you will definitely get an error.
*
*
***********************************************************************
*
* Picture Keys:
* =============
* [-] Minimise, just drops to Icon on bottom left of screen.
* [x] Close without section
* [8] Little calendar - returns/moves to Todays date.
* [/] Tick mark - Select this date and exit.
* [C] Open circular arrow - 'undo' return to orginal date on entry
* [?] Help key, when activated has a / through it (toggle).
*
*
************************************************************************
*
*
* Configuration:
* ==============
*
* The Calendar is fully configurable to use multiple languages and or
* background colours / bitmaps. See important note below.
*
* The current default is English. The only difference between English
* and US-English is the date formatting. The routine operates using
* the Set Date British format and switches the returned value to the
* locale set in ClickDate.ch. Do not change the British format in the
* routine, unless of course you want to give yourself unnecessary
* work going through the entire routine making changes where appropriate.
*
* Not being an expert in languages, not even my native language!,
* the addition of other languages is entirely up to you. The
* ClickDate.ch file has a template for you to customise the calendar
* to the language of your choice.
*
**********************************************************************
*
* IMPORTANT
* =========
* ENTER YOUR LANGUAGE DEFINITIONS IN ClickDate.ch and...
* IN ClickDate.PRG make changes as follows:
*
* AFTER:
* ------
* #include "xbp.ch"
* #include "Appevent.ch"
* #include "Gra.ch"
* #include "common.ch"
* #include "dll.ch"
*
* AND BEFORE #INCLUDE CLICKDATE.CH
* --------------------------------
* ACTIVATE YOUR LANGUAGE DEFINITION DEFINED IN CLICKDATE.CH
* ----------------------------------------------------------
* // #define USENGLISH // USEnglish
* #define ENGLISH
* // define LANGUAGE: GERMAN, SPANISH, ITALIAN, PORTUGUESE etc.
*
* ================================================================
* NOTE: ClickDate.CH MUST _FOLLOW_ YOUR LANGUAGE DEFINITION
* ================================================================
* #include "ClickDate.ch"
*
**********************************************************************