Solved

diarydate calendar in vfp retrun data to form

Posted on 2014-10-23
7
439 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
  • 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 41

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Calling the Excel .OPENTEXT() method from with VFP 12 1,079
Import CSV Files 5 1,149
set order of a table by two fields vfp 4 1,536
Write Caching in the Cloud for VFP9 16 116
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…
As a business owner, there are many things that keep you up at night. Profit margins, employee retention, human resource protocols, whether your product or service will remain competitive. When you own or manage a technology company that operates la…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

778 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