Release 1.0 Copyright ©1994 by Don Yacktman. All Rights Reserved.
Application (MiscAppDefaults) |
Declared In: | <misckit/MiscAppDefaults.h> |
Category Description |
- appDidInit:sender
{
static NXDefaultsVector myDefaults = {
{"BeepOnError", "YES"},
{"NumberOfCows", 4},
{NULL}
};
[NXApp registerDefaults:myDefaults];
and then elsewhere in your program, you could check a default setting with |
if ( [NXApp defaultBoolValue:"BeepOnError"] ) {
NXBeep();
}
and modify an existing default (perhaps in a method that handles Preferences panels) with |
[NXApp setDefault:"NumberOfCows" toInt: 7];
The Defaults system stores all values as a string. This category provides methods for handling
defaults as integers and BOOLeans as well.
Note: The Preferences management system that Don Yacktman is working on will include (1) functional enhancements underneath this interface that enhance the feature set, including a "system" database for setting defaults that are global for all users (and using other arbitrary defaults databases) and (2) a set of GUI tools on top of this interface that allow preferences to be dealt with straight from IB. The upshot of all this is that it is safe for you to use this interface. When Don adds in his material the interface will remain the same and only the implementation will change. It is recommended that you use this interface exclusively and stop using the NX*() functions that deal with defaults so that your app will be able to easily take advantage of the new features when they become available. |
Method Types |
Instance Methods |
defaultBoolValue: |
- (BOOL)defaultBoolValue:(const char *)defName |
- (int)defaultIntValue:(const char *)defName |
- (const char *)defaultValue:(const char *)defName |
- (int)registerDefaults:(const NXDefaultsVector)v |
This method registers a set of defaults by calling NXRegisterDefaults(), and using [NXApp
appName] as the owner of the defaults. Returns 1 on success, 0 on failure.
See also: NXRegisterDefaults()
|
- (int)setDefault:(const char *)defName to:(const char *)defValue |
Sets the value of the default named defName to defValue, and returns 1 on success, 0 on failure.
See also:
|
- (int)setBoolDefault:(const char *)defName toBool:(BOOL)defValue |
- (int)setDefault:(const char *)defName toInt:(int)defValue |
Sets an integer default, by converting defValue from an integer to a string and then calling
![]() |