• 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: Currency Converter (tyler, you there ?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Currency Converter (tyler, you there ?)


  • Subject: Re: Currency Converter (tyler, you there ?)
  • From: Carlos Weber <email@hidden>
  • Date: Sun, 28 Oct 2001 08:41:11 -1000

On Sunday, October 28, 2001, at 06:21 , Irwin Poche wrote:

> In the July archives there's a posting from "tyler" asking why a line of
> Currency Converter only worked when the button Convert is clicked, as
> opposed to pressing Return...
>
> [rateField selectText:self];
>
> I am having exactly the same problem and do not find a solution in the
> archives.
>
> I know it's not a coding goof on mine or tyler's part. I've downloaded
> the
> O'Reilly Learning Cocoa examples which includes Currency Converter and
> it
> exhibits exactly the same symptom.
>
> Anyone know what's going on with this?

How about the following instance method of NSWindow:

- (void)setDefaultButtonCell:(NSButtonCell *)aButtonCell

Makes aButtonCell's key equivalent the Return (or Enter) key, so when
the user presses Return that button performs as if clicked. See the
method description for defaultButtonCell for more information.

Here's an example of it's use in a project of mine:

[[self window]setDefaultButtonCell: [[self createButton]cell]];

I am calling this from my NSWindowController object (self); notice that
you have to ask the associated _window_ to perform the method, and that
the "target" has to be the _cell_ associated with the particular button
you want to be the default. By the way, this will also get you the
pulsing blue behavior that standard Aqua default buttons have.


  • Follow-Ups:
    • Re: Currency Converter (tyler, you there ?)
      • From: Irwin Poche <email@hidden>
References: 
 >Currency Converter (tyler, you there ?) (From: Irwin Poche <email@hidden>)

  • Prev by Date: Re: NSBundle Examples
  • Next by Date: Changing the header size of a NSTableView
  • Previous by thread: Re: Currency Converter (tyler, you there ?)
  • Next by thread: Re: Currency Converter (tyler, you there ?)
  • Index(es):
    • Date
    • Thread