Fox Home

Diary / Calendar

(Updated: 2002.11.18 02:40:17 PM)
Namespace: VFP
Ancient and deprecated feature of Visual FoxPro. Not made pretty in many versions now. (In FoxPro 2.x and VisualFoxPro 3, dates with calendar/diary entries were displayed in bold on the calendar side. By VFP 6, this was no longer a feature.)

Display with:
ACTIVATE WINDOW CALENDAR


Uses the FoxUser resource to store its data.

Handy as a developer resource to store quick-and-dirty notes. However, there are many limitations and infelicities that make this undesirable for a client application. Window interaction is problematic, as this is an unusual system window with some curious behaviors. There are many third-party tools and freely-distributable examples which will serve you better.

Store data programmatically with:

* LogTime.PRG - time entry into resource diary

PARAMETERS tcLogMessage

PRIVATE ALL LIKE l*

IF EMPTY(SET('reso',1))
  WAIT WINDOW PROGRAM() + ": No resource in use!"
  RETURN .F.
ELSE
  lcResSet = SET('RESOURCE')
  SET RESOURCE OFF
ENDIF

lnSelect = SELECT()
SELECT 0
USE SET('reso',1) AGAIN ALIAS Diary
LOCATE FOR TYPE = "DATA" AND ;
  ID   = "DIARYDATA" AND ;
  NAME = DTOS(DATE())

IF NOT FOUND()
  INSERT INTO Diary ;
    (TYPE, ;
    ID, ;
    NAME, ;
    READONLY, ;
    CkVal, ;
    DATA, ;
    UPDATED ;
    ) VALUES ;
    ("DATA", ;
    "DIARYDATA", ;
    DTOS(DATE()), ;
    .F., ;
    0, ;
    TIME() + " " + tcLogMessage, ;
    DATE() ;
    )
ELSE
  REPLACE DATA WITH DATA + CHR(13) + TIME() + " " + tcLogMessage
ENDIF

REPLACE CkVal WITH VAL(SYS(2007, DATA))

USE IN Diary

SELECT (lnSelect)

SET RESOURCE &lcResSet

RETURN


You can then report on the data by extracting it from the resource file.

-- TedRoche
CategoryVFPCommands CategoryCodeSamples