Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 13, 2019 10:57 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: New Preference Solution!
PostPosted: Tue Nov 22, 2011 9:21 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
Hey Tristan,

I get a compiler error. The LastErrorCode computed property has an empty set method, so the line LastErrorCode = 0 in XDB.Save causes an error.

Thanks for the excellent storage classes! :)

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Wed Nov 23, 2011 12:31 am 
Offline
User avatar

Joined: Mon Feb 05, 2007 6:24 pm
Posts: 99
Location: USA
Fixed the issues by setting mLastErrorCode instead. Download link has been updated: http://cl.ly/C3Fd

_________________
Sole Proprietor
10101 Software
http://www.10101software.co.nr/
RB 2011r4.3, MBS 12.4


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Fri Feb 10, 2012 2:36 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
I'm considering switching over to the XDB class, but I'm curious how it handles objects. I have data type only classes that I store into my current Plist class, but I've had to set these up manually. If XDB has has a more elegant way of storing objects, I'd be glad to switch over to it.

Thanks for the excellent work!

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Fri Feb 10, 2012 3:42 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 6:24 pm
Posts: 99
Location: USA
XDB does not store objects because I don't know of any way of serializing objects.

_________________
Sole Proprietor
10101 Software
http://www.10101software.co.nr/
RB 2011r4.3, MBS 12.4


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Fri Feb 10, 2012 3:51 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
If you're able to store dictionaries, I would do it in a similar fashion:

Use introspection to retrieve the object properties. First, make sure every property is data type only, as I'd only support objects one level deep. Then, move from property to property storing them key-value form like you would a dictionary, using the name as the key. Not too bad.

The only thing I'm not sure of is if you can use introspection to create an object by a string name... I don't believe so. If you could you'd simply store the type name along with the other values and use it to reconstruct the object. This isn't a catch all for all objects, but it would certainly handle single-level objects.

A thought. I honestly don't know if it would work on the retrieval end.. I doubt it. :)

The class I'm using, PLIST, has a sort of means for constructing and deconstructing objects into and from dictionaries. I use a key to store the entire key-value array, then use the key to tell myself what it was. It's a bit of extra work, but it does the job well.

Thanks, Tristan!

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Fri Feb 10, 2012 6:07 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 6:24 pm
Posts: 99
Location: USA
Is there an example of introspection that I could look at? I have no idea how to reconstruct either.

Also, XDB sores n-depth arrays and dictionaries so I'd have no problem writing a recursive function for object property types. :D

_________________
Sole Proprietor
10101 Software
http://www.10101software.co.nr/
RB 2011r4.3, MBS 12.4


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Thu May 03, 2012 4:56 pm 
Offline

Joined: Sun Jun 24, 2007 12:24 pm
Posts: 441
Location: Madrid
Hi.

I was looking around and "rediscovered" Xprefs. At the time I dismissed it because it didn't use CFPreferences. This was brought up by other users as a potential problem when submitting to the MAS.

Was it ever updated to handle native methods in each platform? That's CFPreferences for Mac and, I guess, writing to the registry in Windows Pre-7 (and to an xml in Windows 7).

_________________
----
http://eduo.info/
http://gallery.eduo.info/
http://twitter.com/eduo/


Top
 Profile  
Reply with quote  
 Post subject: Re: New Preference Solution!
PostPosted: Thu May 03, 2012 6:39 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 6:24 pm
Posts: 99
Location: USA
No but it now writes to the Application Support (you must supply a sub-folder name) folder which is supported by the MAS and is the way many windows apps store settings.

_________________
Sole Proprietor
10101 Software
http://www.10101software.co.nr/
RB 2011r4.3, MBS 12.4


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group