Re: NSTextField selectText behaviour (Currency Converter Tut)
Re: NSTextField selectText behaviour (Currency Converter Tut)
- Subject: Re: NSTextField selectText behaviour (Currency Converter Tut)
- From: Erika <email@hidden>
- Date: Fri, 17 Jan 2003 17:31:41 +1100
At 4:53 PM +1100 1/17/03, Lachlan Deck wrote:
Hello from another Cocoa beginner in Australia :-)
I've just built the Currency Converter myself, and have noticed the same behaviour. Can't offer any explanations, though...
Another problem with the app which you might have noticed, not being American, is that it's more conceptually oriented towards converting USD to other currencies from the point of view of someone living in the USA, and because exchange rates are given down here on the news with reference to USD (and a few other major currencies), the conversion works the other way around when you're not using USD yourself. I ended up multiplying the amount by 100 an then dividing by the rate so that I could just enter the number of US cents or UK pence one of our dollars will buy, and it's much easier to use intuitively now.
I'm stuck on the issue of rounding off the result to two decimal points, though. There are methods in NSDecimalNumber which will do this, but I haven't worked out how to get them to function properly yet. I've imported the header NSDecimalNumber.h everywhere I can think of, and even copied it into my project manually, but the compiler still tells me the methods for rounding off etc which are declared in that header haven't been declared and that everything will therefore default to type id, and that NSDecimalNumber can't deal with floats. I'm really stuck, and was about to post to the list about it myself. Grrr...
Have you thought of joining Apple's student-dev list? I've received assistance there when ProjectBuilder was playing sillybuggers with me and losing settings, generating weird compiler errors (and also when I made major stuff-ups myself ;-).
>
Hi there,
>
>
Okay, I've checked the archives and what I'm seeing is commonly experienced by most.
>
In ConverterController.m I have the following...
>
>
- (IBAction)convert:(id)sender
>
{
>
...
>
[rateField selectText:self];
>
}
>
>
Now what most people experience is that if you click the Convert button, then the NSTextField, rateField, gains the focus and its text is selected. However, if the user presses the Enter or Return key (even though it's set to be the Equiv in Interface Builder) that the currently selected NSTextField retains the selection.
>
>
I'm guessing that there is a conflict of interest here. i.e., an NSTextField reacts to a typed key (such as Return), however we are trying to remove the focus from the field (which happens automatically if you click with the mouse on the Convert button).
>
>
What is the easiest way to, for example, unconditionally focus the cursor (and thus with selectText method above) for an NSTextField?
>
>
--
_____________________________________________________________________
| Please do not be surprised or distressed if I fail to answer |
| your post for some time. I am a chronic invalid, and am often |
| unable to use my computer for long periods (days, weeks or months). |
| Be assured that I will, however, reply as soon as I can if I can |
|_____________________________________________________________________|
best,
Erica Mackenzie
Megalong Valley,
N.S.W.
AUSTRALIA
________________________________________________________________
| Windows) 98 (n) - 32-bit extensions and graphical shell |
| for a 16-bit patch to an 8-bit operating system |
| originally coded for a 4-bit microprocessor |
| written by a 2-bit company |
| that can't stand 1 bit of competition. |
|________________________________________________________________|
_______________________________________________
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.