Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 2.3

FEATURE

Writing a Preferences Class

Issue: 2.3 (December/January 2003)
Author: Charles Yeomans
Author Bio: Charles Yeomans is a compulsive refactorer.
Article Description: No description available.
Article Length (in bytes): 43,800
Starting Page Number: 13
Article Number: 2309
Resource File(s):

Download Icon 2309.zip Updated: 2013-03-11 19:07:57

Related Link(s): None

Excerpt of article text...

Almost all applications need a way to save preference settings. The goal of this article is to write a reusable preferences class. We're going to write it using practices from test-driven development and design by contract to see if we can get a solid design and reliable code quickly.

Initial Specification

Let's begin by setting out and describing what our Preferences class should do. The main task is to be able to store and retrieve preference settings using string keys -- for example:

App.Prefs.value("BrowserWindowTop") = 25

SomeEditField.TextFont = App.Prefs.Value("Default Font").

...End of Excerpt. Please purchase the magazine to read the full article.