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

NSButton behavior


  • Subject: NSButton behavior
  • From: Herr Witten <email@hidden>
  • Date: Sun, 20 Jun 2004 13:18:59 -0400

I programmatically created a button like this:

NSButton* button = [[[NSButton alloc] init] autorelease];
[button setTitle: @"Cancel"];
[button setTarget: self];
[button setAction: @selector(cancelSheet:)];
[button sizeToFit];

for a sheet. It gave me a NeXTish style button that worked just fine.
So, I figured I would beautify it with this:

[button setBezelStyle: NSRoundedBezelStyle];

and indeed the Aqua style button appeared, but the button border was
broken in the middle, shifted downward. I decided to sidestep the
problem by having the button be the default button so that it would
redraw itself with a pulse. I therefore added these calls:

[button setBezelStyle: NSRoundedBezelStyle];
[button setKeyEquivalent: @"\r"];

And voil`! The button appeared broken momentarily, but the pulsing
immediately redrew it. However, when I clicked on other buttons in the
sheet, the program hung, and when I just clicked the "Cancel" button,
the sheet disappeared, so I conjured another and closed it with the
"Cancel" button, which caused a hang--always on the second closing.

These problems do not occur with the NeXTish style button. Thanks for
any help.
_______________________________________________
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
      • From: Stéphane Sudre <email@hidden>
  • Prev by Date: Re: debugging a static variable
  • Next by Date: Re: Custom buttons
  • Previous by thread: Re: Custom buttons
  • Next by thread: Re: NSButton behavior
  • Index(es):
    • Date
    • Thread