• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: [SOLVED] Waiting for NSMetadataQuery to finish?
  • Next by Date: Re: NSImage drawAtPoint & Transparency
  • Previous by thread: Re: Is NSNotification from NSStepper possible
  • Next by thread: Re: drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
  • Index(es):
    • Date
    • Thread