NSCell question (Last one for today)
NSCell question (Last one for today)
- Subject: NSCell question (Last one for today)
- From: Michael Becker <email@hidden>
- Date: Wed, 19 Nov 2003 20:29:37 +0100
Hi!
This will be my last question for today, i promise :-)
I am trying to display 3 buttons within one cell in a tableview,
programmatically. I think the way to go is to subclass NSCell and draw
the buttons in it, connecting each one to their specific
targets/actions. Now I don't know at all how to DRAW these buttons. I
assume I should use drawInteriorWithFrame:, but I don't know what to do
with it. Here is my (most probably totally laughable) code for one
button (in a subclass of NSCell):
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView {
NSButton* theButton = [[ NSButton alloc] init];
[ theButton setButtonType:NSMomentaryLight];
[ theButton setTitle:@"Push me"];
[ controlView lockFocus];
[ theButton drawRect:cellFrame];
[ theButton setNeedsDisplay:YES];
[ controlView unlockFocus];
return;
}
Since this doesn't display anything (the method is invoked though) I
guess it's wrong. What would be the right way to do what I want to do?
Maybe even use an NSMatrix, or is that just for good looks? When it
works, how can I access the targets (which are obviously different
classes from the "outside")?
Thank you for bearing with me and my question :-)
Bye,
Michael
_______________________________________________
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.