NSButtonCell used alone draws itself in gray, not blue
NSButtonCell used alone draws itself in gray, not blue
- Subject: NSButtonCell used alone draws itself in gray, not blue
- From: Maurice Elallouf <email@hidden>
- Date: Thu, 20 Mar 2003 14:01:06 +0100
Hi,
I'm trying to use a NSButtonCell alone to display a lot of check boxes
from some multi-platform code used in a NSView:
NSButtonCell checkBoxCell = [[NSButtonCell alloc] initTextCell: @""];
[checkBoxCell setButtonType: NSSwitchButton];
[checkBoxCell setControlSize: NSSmallControlSize];
[checkBoxCell setEnabled: YES];
[checkBoxCell setEditable: YES];
[checkBoxCell setSelectable: YES];
I've two problems:
(1) - When I draw it, it always appear in gray color:
- (void) drawRect: (NSRect) rect
{
// ...
// Called many times from a deeper level:
NSRect cellFrame;
NSCellStateValue myState;
[checkBoxCell setState: myState];
[checkBoxCell drawWithFrame: cellFrame inView: self];
// ...
}
I've tryed to compare the internal NSButtonCell values with those
observed in the DragNDropOutlineView example from Apple, where check
boxes appear in good blue, but I did not found any difference.
I've also tryed to play with:
[checkBoxCell highlight: YES withFrame: cellFrame inView: self];
without success (it does nothing).
(2) - I've also problems to track the mouse in the cell: the tracking
works well, but the cell is never highlighted while tracking:
- (void) mouseDown: (NSEvent *) theEvent
{
// Once the cell is identified:
BOOL trackResult = [checkBoxCell trackMouse: theEvent
inRect: cellFrame
ofView: self
untilMouseUp: NO];
}
I would like to use performClick, but how to specify the cell frame
with that method ?
So, what makes a button cell appear in BLUE when it is not owned by a
control, a matrix, or a table view ? And how to track it ?
Any help will be greatly appreciated.
--
Maurice Elallouf
_______________________________________________
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.