Re: Hover button and tracking area questions
Re: Hover button and tracking area questions
- Subject: Re: Hover button and tracking area questions
- From: Markus Spoettl <email@hidden>
- Date: Thu, 24 Jan 2013 16:05:14 +0100
On 1/24/13 3:50 PM, Nick Rogers wrote:
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.
Maybe the superclass (NSButton) isn't smart enough to understand the someone
else may change the tracking areas and does something nasty with it (like
assuming all tracking areas currently added are owned too). What if you remove
before calling super and add afterwards. That way, the superclass doesn't see
your custom tracking areas in -updateTrackingAreas
Something like this:
- (void)updateTrackingAreas
{
if (trackingArea) {
[self removeTrackingArea:trackingArea];
[trackingArea release];
trackingArea = nil;
}
[super updateTrackingAreas];
[self ensureTrackingArea];
[self addTrackingArea:trackingArea];
}
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