drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
- Subject: drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
- From: Dan Donaldson <email@hidden>
- Date: Thu, 19 Oct 2006 16:13:41 -0400
I have an NSTextField subclass. Its function is to provide a cell
with two vertically stacked text areas in one cell.
Things are generally working ok, its being instantiated, put into a
column in an NSOutlineView. I've shifted the default text area down
18.0 pixels, to leave space for the upper textfield. This is an
NSTextFieldCell, stored in an instance variable called titleField in
the cell. This is being created on init of the cell, and that's
confirmed using NSLog.
When I try to draw the extra cell, I use this:
// -----------------------------
- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
NSSize titleSize;
NSRect titleFrame;
titleSize.width = 300.0;
titleSize.height = 18.0;
NSDivideRect
(cellFrame,&titleFrame,&cellFrame,titleSize.height,NSMinYEdge);
NSLog(@"frames: \rcell x: %f y: %f w:%f h:%f \r\r title: x: %f y: %f
w:%f h:%f",
cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width,
cellFrame.size.height,
titleFrame.origin.x, titleFrame.origin.y,
titleFrame.size.width, titleFrame.size.height);
if ( titleField != nil) {
[titleField drawWithFrame:titleFrame inView:controlView];
}
[super drawWithFrame:cellFrame inView:controlView];
}
and the application crashes. I'm not very experienced with Cocoa, but
this seems reasonable. The frames are both there, but it isn't
working...nothing has been done with titleFrame except alloc/init/
autorelease. cellSize is being used to manipulate the row height
correctly.
Help (please)...
Dan Donaldson
416 604 3398
email@hidden
_______________________________________________
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