Re: Cocoa app fails when using 10.4 Universal SDK
Re: Cocoa app fails when using 10.4 Universal SDK
- Subject: Re: Cocoa app fails when using 10.4 Universal SDK
- From: Ricky Sharp <email@hidden>
- Date: Wed, 08 Jun 2005 07:22:42 -0500
On Wednesday, June 08, 2005, at 04:26AM, Andreas Mayer <email@hidden> wrote:
>
>Am 8. Jun 2005 um 04:33 Uhr schrieb Ricky Sharp:
>
>> Has anyone successfully gotten their Cocoa app to run when using
>> the universal 10.4 SDK?
>
>My Universal Binary works just fine (on PPC - no Intel to test yet).
Thanks to all for their replies; glad to hear your apps are a-ok.
I'm not going to rule out a bug in my code, but this could be something strange about the 10.4u SDK. Tonight I'll try out the 10.4 SDK.
Of all my custom widgets (mostly NSControl and NSActionCell subclasses), only my value field is showing this strange behavior.
I was able to trace a bit more into this. When incrementing my value field via the UI (or keyboard 'up arrow'), the following is called in my custom NSControl:
- (void)moveUp:(id)sender
{
int theOldValue = [self currentValue]; // [ A ]
[[self cell] moveUp:sender]; // [ B ]
int theNewValue = [self currentValue]; // [ C ]
if (theNewValue != theOldValue)
{
if ([self observedObjectForCurrentValue] != nil)
{
[[self observedObjectForCurrentValue]
setValue:[NSNumber numberWithInt:theNewValue]
forKeyPath:[self observedKeyPathForCurrentValue]];
}
[self setNeedsDisplay:YES];
}
}
Take for example, one such value field such that its current value is 0 and its min & max are 0 and 18 respectively.
[ A ] executes just fine; theOldValue is 0
[ B ] is I believe where things are getting trashed (more on that below)
[ C ] at this point, theOldValue has been modified to 96 and theNewValue is set to 48.
The bogus values I believe are being taken from the bounds ivar. The values fields happen to be 96pt by 48pt.
Anyhow, my cell's moveUp is implemented like this:
- (void)selectNextValue
{
BOOL theOptionKeyIsDown =
(([[[NSApplication sharedApplication] currentEvent] modifierFlags] &
NSAlternateKeyMask) != 0);
NSView* theControlView = [self controlView];
int theCurrentValue = [self currentValue];
int theIncrementStepSize = 0;
int theModifiedIncrementStepSize = 0;
if ([self delegate] != nil)
{
[[self delegate] valueFieldWillBeIncremented:self
incrementStepSize:&theIncrementStepSize
modifiedIncrementStepSize:&theModifiedIncrementStepSize];
}
else
{
theIncrementStepSize = [self stepSize];
theModifiedIncrementStepSize = [self modifiedStepSize];
}
int theNewValue = theCurrentValue +
(theOptionKeyIsDown ? theModifiedIncrementStepSize : theIncrementStepSize);
int theMaximumValue = [self maximumValue];
if (theNewValue > theMaximumValue)
{
theNewValue = theMaximumValue;
}
if ([theControlView isKindOfClass:[IIValueField class]])
{
[(IIValueField*) theControlView setCurrentValue:theNewValue]; [ D ]
}
else
{
[self setCurrentValue:theNewValue];
}
[NSApp sendAction:[self action] to:[self target] from:self];
}
In this particual example, the cell's delegate is nil, so no special processing there. Since my controlView is an instance of IIValueField, line [ D ] is executed.
Will have more time tonight to further debug. I need to watch the view's ivars and see the exact point where they are being trashed.
Just a wild guess, but the cast to IIValueField* is one of the only casts I have in the entire app. That could be the problem; though right now can't think of why.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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