Solved

diarydate calendar in vfp retrun data to form

Posted on 2014-10-23
7
489 Views
Last Modified: 2014-10-24
Hi: Writing a purchase order system I need to set a required date.  I use the diary date to call up a calendar. The problem is that there does not appear to be a way to get the date selected from the calendar back to the form, without calling the diary date again.
I have this on the click function of a button next to the text box to which I wish to post the date:
ACTIVATE WINDOW calendar
due = _DIARYDATE
THISFORM.Text3.Value = due
Which gives the date currently selected in the calendar ( set at the init stage of the form thus:
_diarydate =  IIF(CDOW(DATE()+1)="Saturday",DATE()+3,DATE()+1))
But if I want to choose a different date, say I choose 31/12/2015 in the calendar, how do I get this new date visible back on the form, without having to click the button again?
Sorry if a dumb question......
0
Comment
Question by:ClaytonGlass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 40399621
The calendar window updates _diarydate, so you could bind to that variable, but there is no way to get a notification/event, when a variable value changes.

You better use a calendar control (OCX), eg mscal or datepicker.

Bye, Olaf.
0
 

Author Closing Comment

by:ClaytonGlass
ID: 40399738
Olaf - if you say so , it must be true.
Thanks!
0
 
LVL 42

Expert Comment

by:pcelba
ID: 40400208
Never say "No way" in FoxPro...  :-)

You may try following code:
RELEASE goForm
PUBLIC goForm
goForm = CREATEOBJECT('Form')

goForm.AddObject('lblDate', 'Label')
WITH goForm.lblDate
  .Top = 20
  .Left = 50
  .Height = 20
  .Width = 150
  .FontSize = 16
  .Visible = .T.
ENDWITH

goForm.AddObject('timGetDiaryDate', 'MyDiaryTimer')

goForm.Visible = .T.
ACTIVATE WINDOW Calendar

DEFINE CLASS MyDiaryTimer AS Timer
Interval = 300
Enabled = .T.

PROCEDURE Timer
  THISFORM.lblDate.Caption = DTOC(_DIARYDATE)
ENDPROC

ENDDEFINE

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 40400355
Well, yes. A timer can be used in many cases, but then there is more to the calendar window less good. It has a note section, which stores notes to each date in a foxuser.dbf. That's per user. Fine, but often you want to not have any foxuser.dbf

Then to mimic a calendar control you'd show the calendar window at a click and wait for the window to be hidden to confirm the choice, or to close automatically, once date is selected or the preselected date is confirmed by clicking or double clicking it. So there are several exit scenarios, some involve a change of _diarydate, some of WVISIBLE('calendar') but what about just clicking on the preselected date? Neither _diarydate nor WVISIBLE() change.

It's much easier and straight forward to use a calendar control and even if you want to avoid OCX for the installation/distribution hurdle there are native solutions from craig boyd using a grid. See http://doughennig.com/papers/..%5CPub%5C200605dhen.pdf and of course http://www.sweetpotatosoftware.com/spsblog/permalink,guid,878c1b11-1770-405c-92ea-cdbe2c838dfa.aspx

Bye, Olaf.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 40400365
0
 

Author Comment

by:ClaytonGlass
ID: 40401946
Thanks to Olaf and pcelba for their expertise as usual!
I have  'doug hennig' date picker and dropped it on the form.
What I don't know how to do is make the data selected populate the field in the table; how do I make the connection between the calendar and the field?
Thanks!
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 40402690
It has a controlsource property you use like normal.

Using the Date and DateTime picker classes is even easier. Drop a CalDatePicker or
CalDateTimePicker object onto a form and set ControlSource to the desired value, such as a Date or
DateTime field

Bye, Olaf.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TSWEB on windows 7 1 1,160
autofill a parameter 5 310
Using CREATEOBJECT() with Excel Starter 4 615
VFP9 wscript.shell .run won't work with task scheduler 9 618
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question