First point:
Using the calendar control in VFP6 as a means for convenient date entry
seems much more complicated than using the same control in VB. With VB
a value is returned containing the selected date. I cannot find a
simpler method of returning the date in VFP than to invoke the following
sort of code:
DateReturned=ctod(ltrim(str(calendar.day))+'/'+ ;
ltrim(str(calendar.month))+'/'+ ;
ltrim(str(calendar.year)))
Am I being really stupid and missing the obvious?
Second point:
Whilst dredging the help file for some clues to the above problem I
happened upon the _DIARYDATE system variable which led to the
Calendar/Diary which I had never encountered before! This could be a
most useful utility to build into my FoxPro applications but there seems
to be no documentation beyond the help file example quoted below.
Any guidance with the above two points would be most gratefully
received. Thank you in advance.
--------------------------------------------------------------------
Quote:
_DIARYDATE System Variable Example
In the following program example, the Calendar/Diary opens with March
28, 2001, selected and the value of _DIARYDATE appears below. July 4,
1776, is then stored to _DIARYDATE and _DIARYDATE displays again. The
program then uses the DATE( ) function to select the current date, and
displays _DIARYDATE.
SET CENTURY ON
STORE {^2001-03-28} TO _DIARYDATE
=MESSAGEBOX(DTOC(_DIARYDATE),64)
ACTIVATE WINDOW calendar
=MESSAGEBOX("Change date to July 4, 1776",48))
STORE {^1776-07-04} TO _DIARYDATE
=MESSAGEBOX(DTOC(_DIARYDATE),64)
=MESSAGEBOX("Change date to today's date",48)
STORE DATE( ) TO _DIARYDATE
=MESSAGEBOX(DTOC(_DIARYDATE),64)
RELEASE WINDOW calendar
-----------------------------------------------------------------
James Lyall.
It was created in 5.0 but 6 should not be a big problem. It's in ZIP format.
Glad to send it if you wish.
best
Dr James Lyall wrote:
--
Shar Feldheim
PC Software,INC -
Visual Foxpro Development -
Minneapolis, Minnesota USA -
***************************************************
Web Site: <http://www.threedub.com>
***************************************************
Office: mailto:afox...@ix.netcom.com
***************************************************
Rick
"Dr James Lyall" <ja...@doclyall.demon.co.uk> wrote in message
news:ssVNBGAv...@doclyall.demon.co.uk...
>I should very much value a little help from an expert.
>
>First point:
>
>Using the calendar control in VFP6 as a means for convenient date entry
>seems much more complicated than using the same control in VB. With VB
>a value is returned containing the selected date. I cannot find a
>simpler method of returning the date in VFP than to invoke the following
>sort of code:
>DateReturned=ctod(ltrim(str(calendar.day))+'/'+ ;
> ltrim(str(calendar.month))+'/'+ ;
> ltrim(str(calendar.year)))
>
>Am I being really stupid and missing the obvious?
date() was changed in VFP 6. It can now take year, month, and
day args and build a date out of them. The year does have to be the
full year (0 for 2000 won't do, etc..). e.g. date(2000,3,30)
[snipped second item of which I know not/naught]
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.
"Dr James Lyall" <ja...@doclyall.demon.co.uk> wrote in message
news:ssVNBGAv...@doclyall.demon.co.uk...
> I should very much value a little help from an expert.
>
> First point:
>
> Using the calendar control in VFP6 as a means for convenient date entry
> seems much more complicated than using the same control in VB. With VB
> a value is returned containing the selected date. I cannot find a
> simpler method of returning the date in VFP than to invoke the following
> sort of code:
> DateReturned=ctod(ltrim(str(calendar.day))+'/'+ ;
> ltrim(str(calendar.month))+'/'+ ;
> ltrim(str(calendar.year)))
>
> Am I being really stupid and missing the obvious?
>
Anders, thank you so much for your response.
>Which calendar control? With either the Microsoft MonthView or the
>MSCAL.Calendar.7
I'm using MS Calendar Control 8.0 which works fine for VB but I see from
another posting today from Henri Visser in thread "Moving from VFP5 to
VFP6" that he repeats your suggested code along with the explanation
that VFP6 handles activeX controls differently from VFP5.
He says:
>2 If you use activeX controls that return values:
>in VFP5 thisform.date = thisform.oleCalendar.value
Which is what I was doing ...
>=> in VFP6 thisform.date = thisform.oleCalendar.object.value
Which is what you suggested and it works - clever man!
Thank you very much for your help and also thanks for bringing MonthView
to my attention. Not previously used it and will try to find it!!
The joys of an expert news group :-)
Best wishes,
James.
"Dr James Lyall" <ja...@doclyall.demon.co.uk> wrote in message
news:UFTTrDAz...@doclyall.demon.co.uk...
Many thanks Anders. Got it running nicely! Quite elegant and useful
ActiveX. Now replacing Calendar control with it in several of our apps.
Best wishes.
James.