A real problem with Prefs!!

charles61 cszasz at mac.com
Tue Aug 3 08:22:02 EDT 2010


Hi Mark,

I tried your suggestion and it works on both my windows and mac apps!!

Here is my revised stack script of my app stack:

on preOpenStack
   set the loc of this stack to the screenloc
   loadPrefs
end preOpenStack

on loadPrefs pFilename
   local tPrefs
   
   --   put url ("binfile:" & pFilename) into tPrefs
   IF the platform is "MacOS" then 
      if there is a file (specialFolderPath(26) & "/" & "S504_prefs") then
         put url ("binfile:" & specialFolderPath("preferences") & "/" &
"S504_prefs") into tPrefs
         
         put arrayDecode(tPrefs) into tPrefs

         -- now fill in all my data...
         put tPrefs["school"] into field "mySchool" of card id 1002 of stack
"prefs"
         put tPrefs["contact"] into field "contact" of card id 1002 of stack
"prefs"
         put tPrefs["email"] into field "email" of card id 1002 of stack
"prefs"
      end if
   end if
   
   IF the platform is "win32" then
      if there is a file (specialFolderPath(26) & "/" & "S504_prefs") then 
         put url ("binfile:" & specialFolderPath(26) & "/" & "S504_prefs")
into tPrefs
         
         put arrayDecode(tPrefs) into tPrefs

         -- now fill in all my data...
         put tPrefs["school"] into field "mySchool" of card id 1002 of stack
"prefs"
         put tPrefs["contact"] into field "contact" of card id 1002 of stack
"prefs"
         put tPrefs["email"] into field "email" of card id 1002 of stack
"prefs"
      end if
   end if
   
end loadPrefs

Please feel free to make any additional comments. This is my first app that
employs a prefs stack. My experience with this have been frustrating at time
but invaluable for future apps. I am posting this code so that it will be
helpful to others.
-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/A-real-problem-with-Prefs-tp2311179p2311755.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the Use-livecode mailing list