• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Preferences
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preferences


  • Subject: Preferences
  • From: R T <email@hidden>
  • Date: Sun, 6 Mar 2005 23:55:17 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

@#$%^... days of frustration... (*&^%

I've got ...MyDocument.nib with a NSTextField to enter
text in, and a NSButton to send the action "setAmt"
(see below) to an  AppController.

The idea is to create 3 user preferences with the
AppController and then be able to change the first
preference, CSAmount with the text field. Below is the
code for the AppController.

I think the Creation of the three preferences works,
but I'm certain, changing the preference doesn't. I
need the float from the textField.....but the button
is used to initiate the action and I don't think any
information contained in the textField is available to
act on.
Help!

--------------------

#import <Cocoa/Cocoa.h>
@class PreferenceController;


@interface AppController : NSObject {
	PreferenceController *preferenceController;
	IBOutlet NSTextField *amtTextField;
}
- (IBAction)setAmt:(id)sender;

@end

--------------------------------------------


#import "AppController.h"
#import "PreferenceController.h"


@implementation AppController

+ (void)initialize
{
	// Create a directory
	NSMutableDictionary *defaultValues =
[NSMutableDictionary dictionary];


	// Put defaults in the dictionary
	[defaultValues setObject:[NSNumber
numberWithFloat:4000.] forKey:CSAmount];
	[defaultValues setObject:[NSNumber
numberWithFloat:1.440]
forKey:CSDilutionLimitsStarten];
	[defaultValues setObject:[NSNumber
numberWithFloat:2.0] forKey:CSDilutionLimitsStartN];

	// Register the Dictionary of defaults
	[[NSUserDefaults standardUserDefaults]
registerDefaults: defaultValues];

	NSLog(@"registered defaults: %@", defaultValues);
}

- (IBAction)setAmt:(id)sender
{
	NSUserDefaults *defaults;
	defaults = [NSUserDefaults standardUserDefaults];
	[defaults setFloat:[amtTextField floatValue]
forKey:CSAmount];
	NSLog(@"registered default: %d",[CSAmount
floatValue]);
}

- (void)dealloc
{
	[super dealloc];
}

@end

--------------------------------------

Thanks
Rick T




__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Creating a JavaVM with JNI & Re:JavaBridge
  • Next by Date: Re: App termination for MAC reboot
  • Previous by thread: Re: App termination for MAC reboot
  • Next by thread: SystemStatusBar question
  • Index(es):
    • Date
    • Thread