Re: drawingRectForBounds not being called
On Jul 31, 2010, at 8:31 AM, Tony Romano wrote: > Here is one additional thing I discovered. I have an outlet to the > NSTextField that contains the cell so I can write text to it. This is the > only connection to my application. If I remove the outlet, the > drawingRectForBounds: is called. If I add it back, it won't get called. Why > should having an outlet to the control have any affect on this method getting > called. Something weird is going on. Well the most likely thing is that you're doing something with the outlet, and whatever that thing is, it results in the text field or its cell being configured in such a way that your override isn't called. Post all the code that uses the outlet. --Kyle Sluder___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: drawingRectForBounds not being called
Here is one additional thing I discovered. I have an outlet to the NSTextField that contains the cell so I can write text to it. This is the only connection to my application. If I remove the outlet, the drawingRectForBounds: is called. If I add it back, it won't get called. Why should having an outlet to the control have any affect on this method getting called. Something weird is going on. -Tony On Jul 30, 2010, at 4:05 PM, Tony Romano wrote: > @interface ViewStatusTextCell : NSTextFieldCell > > - (NSRect)drawingRectForBounds:(NSRect)theRect; > > @end > > - (NSRect)drawingRectForBounds:(NSRect)theRect > { > NSRect rect = [super drawingRectForBounds:theRect]; > NSSize textSize = [self cellSizeForBounds:theRect]; > > NSUInteger heightDelta = rect.size.height - textSize.height; > if (heightDelta > 0) { > rect.size.height -= heightDelta; > rect.origin.y += heightDelta/2; > } > > return rect; > } > > On Jul 30, 2010, at 4:03 PM, Kyle Sluder wrote: > >> On Fri, Jul 30, 2010 at 3:38 PM, Tony Romano wrote: >>> I have an NSTextTextField in my nib that is using a custom NSTextFieldCell >>> (set in IB) class that has only one method over-riden, >>> drawingRectForBounds. The method is not being called. This is what I have >>> done. >>> >>> 1. Set a break point to verify it is not being called. >>> 2. Using F-Script, verified that the instance of NSTextField is using my >>> custom cell. I can invoke my method via F-Script as well. >>> 3. Verified the correct spelling and signature of the method. >> >> Are you certain? The method is named -drawingRectForBounds:. Since you >> omitted the colon above, I am wondering if you have in fact misspelled >> the method. >> >> Please post your code. >> >> --Kyle Sluder >> > > -Tony > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/tonyrom%40hotmail.com > > This email sent to tony...@hotmail.com > -Tony ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: drawingRectForBounds not being called
@interface ViewStatusTextCell : NSTextFieldCell - (NSRect)drawingRectForBounds:(NSRect)theRect; @end - (NSRect)drawingRectForBounds:(NSRect)theRect { NSRect rect = [super drawingRectForBounds:theRect]; NSSize textSize = [self cellSizeForBounds:theRect]; NSUInteger heightDelta = rect.size.height - textSize.height; if (heightDelta > 0) { rect.size.height -= heightDelta; rect.origin.y += heightDelta/2; } return rect; } On Jul 30, 2010, at 4:03 PM, Kyle Sluder wrote: > On Fri, Jul 30, 2010 at 3:38 PM, Tony Romano wrote: >> I have an NSTextTextField in my nib that is using a custom NSTextFieldCell >> (set in IB) class that has only one method over-riden, drawingRectForBounds. >> The method is not being called. This is what I have done. >> >> 1. Set a break point to verify it is not being called. >> 2. Using F-Script, verified that the instance of NSTextField is using my >> custom cell. I can invoke my method via F-Script as well. >> 3. Verified the correct spelling and signature of the method. > > Are you certain? The method is named -drawingRectForBounds:. Since you > omitted the colon above, I am wondering if you have in fact misspelled > the method. > > Please post your code. > > --Kyle Sluder > -Tony ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: drawingRectForBounds not being called
On Fri, Jul 30, 2010 at 3:38 PM, Tony Romano wrote: > I have an NSTextTextField in my nib that is using a custom NSTextFieldCell > (set in IB) class that has only one method over-riden, drawingRectForBounds. > The method is not being called. This is what I have done. > > 1. Set a break point to verify it is not being called. > 2. Using F-Script, verified that the instance of NSTextField is using my > custom cell. I can invoke my method via F-Script as well. > 3. Verified the correct spelling and signature of the method. Are you certain? The method is named -drawingRectForBounds:. Since you omitted the colon above, I am wondering if you have in fact misspelled the method. Please post your code. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
drawingRectForBounds not being called
I have an NSTextTextField in my nib that is using a custom NSTextFieldCell (set in IB) class that has only one method over-riden, drawingRectForBounds. The method is not being called. This is what I have done. 1. Set a break point to verify it is not being called. 2. Using F-Script, verified that the instance of NSTextField is using my custom cell. I can invoke my method via F-Script as well. 3. Verified the correct spelling and signature of the method. Anyone have other ideas as to what I am overlooking? Thanks, -Tony ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com