Re: Hover button and tracking area questions
Re: Hover button and tracking area questions
- Subject: Re: Hover button and tracking area questions
- From: Nick Rogers <email@hidden>
- Date: Thu, 24 Jan 2013 20:20:05 +0530
Hi,
Thanks for the reply.
The code for HoverButton class is almost same as I posted in the first email with the exception that in the following method I was removing trackingArea before releasing it.
- (void)updateTrackingAreas
{
if (trackingArea) {
[self removeTrackingArea:trackingArea];// its there in the code that I have
[trackingArea release];
trackingArea = nil;
}
[self ensureTrackingArea];
[self addTrackingArea:trackingArea];
[super updateTrackingAreas];
}
mouseEntered: and mouseExited: and other methods do not touch the trackingArea at all.
This puzzled me and so I asked whether the tab view showing these button changing tab item to another and thus making these buttons invisible would have any repercussions. Or calling [super updateTrackingAreas]; at the beginning or end of the method updateTrackingAreas would make any difference.
Another was any ill effect of removing and adding tracking area, which I am not doing now as the button is not resizable.
Thanks,
Nick
On 24-Jan-2013, at 7:24 PM, Markus Spoettl <email@hidden> wrote:
> On 1/24/13 12:06 PM, Nick Rogers wrote:
>> The code that I pasted was going thru change. In the original copy, I was
>> removing tracking area before adding the new.
>>
>> So now my thinking goes that I shouldn't have added tracking areas after the
>> initial one, at least I am now doing that and hoping it not to crash.
>
> I'm doing this (dynamically removing and adding tracking areas) all the time, and while it does have drawbacks that Kyle explained, it works just fine. If your memory management is OK, this will work. The fact that you're crashing indicates that you're over-releasing your tracking area (or something else is). Post your real code, we may spot something.
>
> Regards
> Markus
> --
> __________________________________________
> Markus Spoettl
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden