• 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
Re: NSButton behavior [weirder]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButton behavior [weirder]


  • Subject: Re: NSButton behavior [weirder]
  • From: Herr Witten <email@hidden>
  • Date: Mon, 21 Jun 2004 11:36:38 -0400

I traced the problem back to the drawRect: method of the view that
contains the button. In that method, an attributed string is draw with
drawAtPoint: and the program stops with this backtrace:

#0 0x90016f48 in semaphore_wait_signal_trap
#1 0x9000e790 in _pthread_cond_wait
#2 0x92dca4e4 in -[NSViewHierarchyLock lockForWriting]
#3 0x92de83d4 in -[NSView addSubview:]
#4 0x92e1d94c in -[NSStringDrawingTextStorage
drawTextContainer:inRect:onView:pinToTop:]
#5 0x92e81960 in -[NSAttributedString(NSStringDrawing) drawInRect:]
#6 0x92ed1f54 in -[NSAttributedString(NSStringDrawing) drawAtPoint:]

In order to fix the problem I had to change the string attributes from:

NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont boldSystemFontOfSize: 16.0f], NSFontAttributeName,
[NSNumber numberWithInt: 2], NSUnderlineStyleAttributeName,
nil];

to this:

NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont boldSystemFontOfSize: 16.0f], NSFontAttributeName,
nil];
//[NSNumber numberWithInt: 1], NSUnderlineStyleAttributeName,
nil];

In other words, there is trouble with drawing the underline.

On 20 Jun 2004, at 21:53, Herr Witten wrote:

> Thanks for the reply, but the problem still persists.
>
> I think it has to do with the pulse drawing. The other bezel options
> don't freeze it.
>
> On 20 Jun 2004, at 15:43, Stiphane Sudre wrote:
>
>> I hope you won't bang your head against the wall after reading this:
>
> I did that before I read it.
>
>>
>> Instead of calling [ sizeToFit] before [ setBezelStyle:
>> NSRoundedBezelStyle], just call it after.
>
> Actually, that what I've been doing. Here is the code with your
> additions,:
>
> NSButton* button = [[NSButton alloc] initWithFrame: NSZeroRect];
> [button setBezelStyle: NSRoundedBezelStyle];
> [button setKeyEquivalent: @"\r"];
> [button setTitle: NSLocalizedString(@"Cancel", @"")];
> [button setTarget: self];
> [button setAction: @selector(cancelSheet:)];
> [button sizeToFit];
>
>> * Use initWithFrame instead of init
>
> I don't have any particular frame, so is not init the same as above?
> _______________________________________________
> 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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: NSButton behavior [weirder]
      • From: Herr Witten <email@hidden>
References: 
 >Re: NSButton behavior (From: Stéphane Sudre <email@hidden>)
 >Re: NSButton behavior (From: Herr Witten <email@hidden>)

  • Prev by Date: Re: How to implement NSBrowser -shouldSelectCell:?
  • Next by Date: Sleeping and waking NSThread
  • Previous by thread: Re: NSButton behavior
  • Next by thread: Re: NSButton behavior [weirder]
  • Index(es):
    • Date
    • Thread