Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calendar control and "Calendar/Diary" problem with VFP6

186 views
Skip to first unread message

Dr James Lyall

unread,
Mar 30, 2000, 3:00:00 AM3/30/00
to
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?

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.

Shar Feldheim

unread,
Mar 30, 2000, 3:00:00 AM3/30/00
to Dr James Lyall
If I remember, I have a form with the calendar ole object included. There is
some code in it that may be of use to you.

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 Bean

unread,
Mar 30, 2000, 3:00:00 AM3/30/00
to
James,
The "only" real problem with the built in Calendar/Diary, is that the data
is stored in the resource file (FOXUSER.DBF by default). FP opens the
resource file EXCLUSIVE, so it's impossible to share this data in a
multi-user environment, especially if each user has their own copy of
FOXUSER <s>.

Rick

"Dr James Lyall" <ja...@doclyall.demon.co.uk> wrote in message
news:ssVNBGAv...@doclyall.demon.co.uk...

Gene Wirchenko

unread,
Mar 30, 2000, 3:00:00 AM3/30/00
to
Dr James Lyall <ja...@doclyall.demon.co.uk> wrote:

>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.

Anders Altberg

unread,
Mar 31, 2000, 3:00:00 AM3/31/00
to
Hi
Which calendar control? With either the Microsoft MonthView or the
MSCAL.Calendar.7 it's just
x = Thisform.oleMonthView.Object.Value
or
x = TToD(Thisform.oleCalendar.Object.Value)
which cuts out the hours part.
The _DiaryDate system variable was used with the much simpler Calendar that
first appeared as a built in utility into FoxPro 1(?). It's still there for
backwards compatability - ACTIVATE WINDOW Calendar
-Anders

"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?
>

Dr James Lyall

unread,
Apr 1, 2000, 3:00:00 AM4/1/00
to
To Anders Altberg <anders....@swipnet.se>

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.

Anders Altberg

unread,
Apr 1, 2000, 3:00:00 AM4/1/00
to
Hi
You should find Microsoft DateTimePicker and Microsoft Monthview in the
ActiveX listing.
-Anders

"Dr James Lyall" <ja...@doclyall.demon.co.uk> wrote in message

news:UFTTrDAz...@doclyall.demon.co.uk...

Dr James Lyall

unread,
Apr 2, 2000, 4:00:00 AM4/2/00
to
In article <etN0XjCn$GA.257@cppssbbsa05>, Anders Altberg
<anders....@swipnet.se> writes

>You should find Microsoft DateTimePicker and Microsoft Monthview in the
>ActiveX listing.

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.

0 new messages