Re: Really weird NSTextView behaviour
Re: Really weird NSTextView behaviour
- Subject: Re: Really weird NSTextView behaviour
- From: Michael Watson <email@hidden>
- Date: Wed, 25 Oct 2006 17:48:46 -0400
Tried -setStringValue instead?
--
mikey
On 25 Oct, 2006, at 17:42, David Aames wrote:
Hello all,
I've wasted several hours (about 4) today debugging something
really simple and now I've found where the behavior is coming from:
NSTextView. Let me first explain what the situation is. I have a
table and each row basically is an object in a NSMutableArray and
when a row is clicked the method retrieves the object for that row
and sets the values of some NSTextFields and a NSTextView. I'm
using the - (void)textDidChange:(NSNotification *)aNotification
delegate method to know when the text view has changed. The method
is implemented as shown below:
NSLog(@"Address changed");
NSText* t = [aNotification object];
DALocation* loc = [self currentSelectedLocation];
NSLog(@"Setting the address to %@", [t string]);
[loc setLocationAddress:[t string]];
NSLog(@"Location object is %@", loc);
Now this works fine. I've put a breakpoint to check if the actual
address property is modified, etc and it is ok. Now when I click
another row the address suddenly becomes empty! And the setter for
the address is never called (I've put a breakpoint on it). Here's
my action method for the table:
-(IBAction)clickedLocationsTable:(id)sender
{
if([self currentSelectedLocation])
{
NSLog(@"Clicked on a valid row");
[self enableLocationEditboxes];
DALocation* loc = [self currentSelectedLocation];
NSLog(@"Current clicked location object is: %@", loc);
[tagsLocsLocationName setStringValue:[loc name]];
NSString* add = [loc locationAddress];
[tagsLocsLocationView setString:add]; // !!!!!!! OFFENDER
}
else
[self disableLocationEditboxes];
}
Stepping through that code shows that the call setString: to
NSTextView somehow changes the location address property of the
previous selected object (circumventing the setter in some way).
Now I'm really puzzled - how can this method change some internal
value of my object??? I've tried using watchpoints but I couldn't
get them to run (the hardware rwatch and awatch commands). The
normal watch command is pretty useless since it doesn't work out of
scope. Any tips for unravelling this mystery are greatly appreciated.
Regards,
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40bungie.org
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