On Aug 23, 2006, at 6:19 PM, Norman Palardy wrote:
On Aug 23, 2006, at 5:05 PM, Michael D Mays wrote:
I am doing the following in an action event of a button
dim aDate as new date
dim testBool as Boolean
testBool = ParseDate(invoiceDate.TEXT,aDate)
aDate.TotalSeconds = adate.TotalSeconds - 86400
invoiceDate.text = aDate.LongDate
I build an application on Max OSX 10.4 for OSX and Windows XP. The
Mac app decrements the date in the edit field (invoiceDate) each
time I click the button. When I run the Windows app in XP on a
Intel iMac running Parallels, it decrements one time and then does
nothing.
Should this work on Windows?
ParseDate just uses the OS facilities to parse the dat information
so it seems that Windows does not understand the date for some reason
I created a little app with one window with a push button and an
editfield
in the window open I have
dim aDate as new date
invoiceDate.text = aDate.LongDate
in the push button action I have your code
dim aDate as new date
dim testBool as Boolean
testBool = ParseDate(invoiceDate.TEXT,aDate)
aDate.TotalSeconds = adate.TotalSeconds - 86400
invoiceDate.text = aDate.LongDate
This works on OS X but on windows it does NOT parse the date
properly (testBool is false) and so nothing else works quite right
and the date only goes back one day then remains there. The reason
it does this is because this line
dim aDate as new date
has created aDate and set it to the current date and time
Since the parse date fails, aDate is not altered and then the line
aDate.TotalSeconds = adate.TotalSeconds - 86400
simply goes back in time one day
It will be this same sequence every time you press the button
making it appear that the date refuses to decrement
You'd be able to see the parseDate failure better if you did
dim aDate as DATE
and check testBool
testBool will be true IF the text could be reasonably interpreted
as a date (perhaps not accurately though) and false if not
some date formats are ambiguous like
3/4/2006
is this Mar 4, 2006 ? or April 3 2006 ?
Either one is possibly right
in my little app if you use this in the push button
dim aDate as date
dim testBool as Boolean
testBool = ParseDate(invoiceDate.TEXT,aDate)
aDate.TotalSeconds = adate.TotalSeconds - 86400
#if TargetWin32
invoiceDate.text = aDate.ShortDate
#else
invoiceDate.text = aDate.LongDate
#endif
and thi in the window open (to initialize the text in the edit field)
dim aDate as date
#if TargetWin32
invoiceDate.text = aDate.ShortDate
#else
invoiceDate.text = aDate.LongDate
#endif
things work OK on both OS X and Windows (at least with the way my OS
X and Windows are configured - YMMV)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>