Since time immemorial I've used CFPreferences to store dates into the prefs of 
my app. Since I while I can see this failing - sometimes - with a result of 
"31.12.0002 00:53:28" or similar. Unfortunately, this causes my app to run 
amok. The scheduling component thinks the main app didn't do anything and 
starts the app every minute.

Now the keyword here is "sometimes". For RB2011r4 and MBS 13.1 it mostly works 
- except for one customer. For Xojo 2013r3 and MBS 13.2 it doesn't work for me 
at the moment at all.

Calling code example:

dim currentDate as new Date
globals.thePrefs.setPrefDate("Schedule_LastDate", currentDate)

Code for prefs:

Sub SetPrefDate(fieldName as string, fieldValue as Date)
  
  'set a date preference value
  
  dim theGregDate as new CFGregorianDateMBS
  if fieldValue = nil then
    theGregDate.year = 0
    theGregDate.month = 0
    theGregDate.day = 0
    theGregDate.Hour = 0
    theGregDate.Minute = 0
    theGregDate.Second = 0
  else
    theGregDate.year = fieldValue.year
    theGregDate.month = fieldValue.month
    theGregDate.day = fieldValue.day
    theGregDate.Hour = fieldValue.Hour
    theGregDate.Minute = fieldValue.Minute
    theGregDate.Second = fieldValue.Second
  end if
  
  dim theCFTime as CFAbsoluteTimeMBS
  theCFTime = theGregDate.AbsoluteTime(nil)
  dim theCFDate as CFDateMBS = newCFDateMBS
  theCFDate = theCFTime.Date
  dim theCFObject As CFObjectMBS = theCFDate
  
  dim theCFPrefs as new CFPreferencesMBS
  theCFPrefs.SetAppValue(NewCFStringMBS(FieldName), theCFObject, 
theCFPrefs.kCFPreferencesCurrentApplication)
  if not theCFPrefs.AppSynchronize(theCFPrefs.kCFPreferencesCurrentApplication) 
Then Break
  
End Sub


Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to