• 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: NSTextField getting input number by number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField getting input number by number


  • Subject: Re: NSTextField getting input number by number
  • From: "Jay Rimalrick" <email@hidden>
  • Date: Sun, 16 Nov 2003 14:05:44 -0500

Althoug I am not sure exactly why this works, the suggestion that you noted
below does work:

float1 = [[[[aNotification userInfo] objectForKey:@"NSFieldEditor"] string]
floatValue];

Thank you to everyone for all of your help and especially louis. You are a
testimate to the helpful nature of the apple community and a great help on
this mailing list.

I will keep everyone updated.

Thanks again,
-jay


---------- Original Message ----------------------------------
From: "Louis C. Sacha" <email@hidden>
Date: Sat, 15 Nov 2003 22:43:43 -0800

>Hello...
>
>An updated version of my previous message, since I got the message
>with your code when I checked my mail to send my other message :)
>
>You are saving the value you get to your instance variable (float1 or float2).
>
>Somewhere in the DoCalculations method, you update the interface with
>the new values, right?
>If you set the values of the two textfields during that method call,
>using the values saved in float1 and float2, you might be causing the
>loss of the decimal point (see my previous message for more details
>on that).
>
>If you aren't updating the textFields, there's also the possibility
>that when you call floatValue for the textfield, the textField is
>somehow resetting itself. The fix for that would be:
>
>- (void)controlTextDidChange:(NSNotification *)aNotification
>{
> if([aNotification object] == textField1)
> float1 = [[[[aNotification userInfo]
>objectForKey:@"NSFieldEditor"] string] floatValue];
> else if([aNotification object] == textField2)
> float2 = [[[[aNotification userInfo]
>objectForKey:@"NSFieldEditor"] string] floatValue];
>
> [self DoCalculations];
>}
>
>I hope one of my two messages helps you to figure it out...
>
> Louis
>
>
>>Here is the code:
>>
>>- (void)controlTextDidChange:(NSNotification *)aNotification
>>{
>> if([aNotification object] == textField1)
>> float1 = [textField1 floatValue];
>> else if([aNotification object] == textField2)
>> float2 = [textField2 floatValue];
>>
>> [self DoCalculations];
>>}
>>
>>textField1 and 2 are IBOutlets
>>
>>DoCalculations is a function that does calculations based on the
>>values of float1
>>and float2
>>
>>I hope this helps.
>>
>>-jay
>_______________________________________________
>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.
>




________________________________________________________________
Sent via the WebMail system at 1st.net
_______________________________________________
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: NSTextField getting input number by number
      • From: "Louis C. Sacha" <email@hidden>
  • Prev by Date: Re: Binding Dependencies
  • Next by Date: Saving table/outline table configuration...
  • Previous by thread: Re: NSTextField getting input number by number
  • Next by thread: Re: NSTextField getting input number by number
  • Index(es):
    • Date
    • Thread