Toolbar and tracking rects problem
Toolbar and tracking rects problem
- Subject: Toolbar and tracking rects problem
- From: Luc Vandal <email@hidden>
- Date: Fri, 2 Sep 2005 09:08:28 -0400
Hi,
I managed to get tracking rects to work with custom toolbar items
with views. I do get the mouseEntered message when the mouse cursor
is over one of the item but something strange is happening. Somehow,
it seems that the tracking rects are also somewhere else in the
screen. If the mouse cursor is over a certain part of the screen,
mouseEntered will be triggered even though it's not even over a
toolbar item. What did I do wrong? Here's some code:
@implementation VRToolbarItemView
- (void)frameDidChange:(NSNotification*)notification
{
[self addTrackingRect:[self bounds]
owner:self
userData:nil
assumeInside:NO];
}
- (void)mouseEntered:(NSEvent *)event
{
...
}
@end
@implementation VRAppController
- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar
itemForItemIdentifier: (NSString *) itemIdent
willBeInsertedIntoToolbar:(BOOL) willBeInserted {
NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc]
initWithItemIdentifier: itemIdent] autorelease];
if ([itemIdent isEqual: OpenBookItemIdentifier])
{
m_viewOpenBook = [[VRToolbarItemView alloc]
initWithFrame:NSMakeRect(0,0,32,32)];
[toolbarItem setTarget:m_viewOpenBook];
[toolbarItem setView:m_viewOpenBook];
[toolbarItem setMinSize:NSMakeSize( 32, 32 )];
[toolbarItem setMaxSize:NSMakeSize( 32, 32 )];
[toolbarItem setImage:[NSImage imageNamed: @"icone1"]];
}
}
Thanks!
Luc
_______________________________________________
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