• 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 - NSTextField selectText: Works Sometimes! Bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Currency Converter - NSTextField selectText: Works Sometimes! Bug?


  • Subject: Re: Currency Converter - NSTextField selectText: Works Sometimes! Bug?
  • From: tyler <email@hidden>
  • Date: Sun, 15 Jul 2001 22:43:45 -0700

Hey there,
OK. So I figured out that the [rateField selectText:self] works when you "click" the "Convert" button with the mouse, but NOT when you hit return to activate the button!

SO, this seems odd.
It appears that the code that handles the default button doesn't "eat" the return key event.
So the NSTextField handles the return char normally, by selecting all the text in the field (kind of like an "enter" action).

Does this make sense? Is this a bug that Apple needs to know about? Or should there be a different direction on how to set up the nib file for this example or something else?

peace,
tyler


On Sunday, July 15, 2001, at 01:31 PM, tyler wrote:

Hey,
Learning Cocoa book (1st ed), page 122 in the code for the method convert:


-(IBAction)convert:(id)sender
{
float rate, amt, total;

amt = [dollarField floatValue];
rate = [rateField floatValue];

total = [converter convertAmount:amt atRate:rate];

[totalField setFloatValue:total];
[rateField selectText:self]; // THIS LINE DOESN'T SEEM TO WORK
}


The last line doesn't seem to work: [rateField selectText:self];

I do not see the rate field get selected. Is this a "Known Bug" in NSTextField (or some such)? Or a badly written sample? What is the proper way to change the active text field in the UI if this isn't it?

Thanks in advance,
tyler
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Currency Converter sample [rateField selectText:self]; doesn't work...? (From: tyler <email@hidden>)

  • Prev by Date: Re: Currency Converter sample [rateField selectText:self]; doesn't work...?
  • Next by Date: NSURL loadResourceDataNotifyingClient
  • Previous by thread: Currency Converter sample [rateField selectText:self]; doesn't work...?
  • Next by thread: Bug in NSFormatter
  • Index(es):
    • Date
    • Thread