Re: NSMatrix crash sigsev11
Re: NSMatrix crash sigsev11
- Subject: Re: NSMatrix crash sigsev11
- From: "Geert B. Clemmensen" <email@hidden>
- Date: Mon, 21 Feb 2005 10:47:04 +0100
NSMutableString *alreadyThere;
[alreadyThere appendString: [textField stringValue]];
alreadyThere is, at this stage, an uninitialized variable and trying to send it the appendString: message will cause a crash. You could instead do something like this:
alreadyThere = [NSMutableString stringWithString:[textField stringValue]];
Regards,
Geert B. Clemmensen
www.frontbase.com
On 21. feb 2005, at 10.30, Daniel Child wrote:
Hi All,
I am still struggling with NSMatrix cells, and have written a dumb app to try to punch numbers into a textfield. I have found two things odd so far.
1) When I instantiated the MatrixConstroller and then asked IB to create the h and m files, the files did not contain the standard methods regarding awakeFromNib and so forth. Why the barebones m file?
2) The button cells cause a crash when you click on a button. Here is the implementation file.
#import "MatrixController.h"
@implementation MatrixController
- (id)sender // action triggered by clicking on matrix
{
id theCell;
int theTag;
NSMutableString *alreadyThere;
[alreadyThere appendString: [textField stringValue]];
theCell = [theMatrix selectedCell];
[alreadyThere appendString: [theCell title]]; // button titles are 1, 2, etc.
}
- (id)sender // there is a button to clear the field
{
[textField setStringValue: @""];
}
@end
Thanks in advance!
Daniel
_______________________________________________
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
_______________________________________________
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