Re: Currency Converter - NSTextField selectText: Works Sometimes! Bug?
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