Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

diarydate calendar in vfp retrun data to form

Posted on 2014-10-23
7
Medium Priority
?
614 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 30

Accepted Solution

by:
Olaf Doschke earned 1500 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 43

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
Independent Software Vendors: 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 30

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 30

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 30

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

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…
The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

661 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