If this is your first time reading this, you probably haven't signed up yet. Do so now by clicking here.

Members Login

Username:
Password:
Remember me ?      

Advertisement

Recommended Books

Partner Links

Forum - iDevApps » Mac, iPhone, iPad & iPod Development » Mac OS X Programming » Set the value of one NSTextField to the value of another?

Mac OS X Programming Questions and tips on developing Mac OS X applications, as well as porting.

Reply
Old 2009.02.07, 06:08 AM   #1
thedreamapps
Null
 
Join Date: Aug 2007
Posts: 15
Default Set the value of one NSTextField to the value of another?

Hey guys... I quite new to this so hear me out...

I have 4 IBOutlets.

ABName
ABEmail

CLName
CLEmail

I have an IBAction connected to a button, and what I want to do, is when the button is pushed have CLName & CLEmail populated with the values from ABName & ABEmail.

Here is my code, but I think it is completely wrong...
Code:
#import "AddressBookImporter.h"

@implementation AddressBookImporter
- (IBAction)importFromAB:(id)sender {
    NSString *email = [NSString stringWithString:ABEmail];
	NSString *name = [NSString stringWithString:ABName];
	
	[CLEmaill setStringValue:email];
	[CLName setStringValue:name];
}
@end
thedreamapps is offline   Reply With Quote
Old 2009.02.11, 02:54 PM   #2
dcavanagh
Null
 
Join Date: Dec 2007
Posts: 4
Default

Assuming that the first two outlets are connected to your class instance, and that they are also NSTextFields, IIRC you probably want [newTextField setStringValue:[oldTextField stringValue]]

Right now your code is attempting to set the text field's value to the pointer to the other text field, not to its stringValue.

HTH
dcavanagh is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:17 AM.