[Q] Activating an NSButtonCell
[Q] Activating an NSButtonCell
- Subject: [Q] Activating an NSButtonCell
- From: Mark de Jong <email@hidden>
- Date: Wed, 11 Sep 2002 18:54:07 -0700
Hi!
I've overridden NSSplitView because I'd like to add an NSButtonCell in
the divider column that allows the split view to be toggle between
being open or closed.
In awakeFromNib, I've got the following:
- (void)awakeFromNib
{
[self setDelegate:self];
NSImage *arrowImage = [NSImage imageNamed:MDJ_IMAGE_SMALLARROWS];
arrowButton = [[NSButtonCell alloc] initImageCell:arrowImage];
[arrowButton setBordered:NO];
[arrowButton setTarget:self];
[arrowButton setAction:@selector(slideResize:)];
[arrowButton setEnabled:YES];
}
And in drawDividerInRect:, I have the following:
- (void)drawDividerInRect:(NSRect)rect
{
[super drawDividerInRect:rect];
if( arrowButton )
{
[arrowButton
drawWithFrame:
NSMakeRect(
rect.origin.x,
rect.origin.y + [[arrowButton image] size].height +
20,
[[arrowButton image] size].width + 2,
[[arrowButton image] size].height + 2 )
inView:self];
}
}
The "arrowButton" appears exactly where I would like it to. However, it
does not respond to mouseclicks at all.
I think I need to add arrowButton to the responder chain. If so, how do
I do this?
Alternatively, is there a better way to go about doing this?
Thanks!
-- Mark
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.