Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7829101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:37:04+00:00 2026-06-02T10:37:04+00:00

I’m making a small program that has four NSTextField boxes. Each box is related

  • 0

I’m making a small program that has four NSTextField boxes. Each box is related to the others by a formula. Basically, I have it working right now where after you click out of the box, it’ll calculate the other boxes just fine (you can enter numbers into any of the boxes).

What I want is the after each key-press, I’d like to call the boxes action to calculate the other boxes. So, the results should happen immediately, not only after clicking out of the box or hitting tab, etc..

I’m still learning ObjC, so, while I’ve tried to review the docs, they don’t seem to apply directly to my issue.

I’ve defined the following actions:

- (IBAction)boxX1:(id)sender;
- (IBAction)boxY1:(id)sender;
- (IBAction)boxX2:(id)sender;
- (IBAction)boxY2:(id)sender;

For each one, there’s some code that calls the calculate function in the right way…

So, the basic question is.. How do I watch keyDown: events, and specifically, know that the keyDown event happened in boxX1 vs. boxY2 and, be able to take the content of the boxes (after the keyDown event) and perform my calculation?

For example, here’s the code for boxX2:

- (IBAction)boxY2:(id)sender {
    self.boxX2.stringValue = [ARCBrain calculateRatio:self.boxX1.stringValue times:self.boxY2.stringValue dividedBy:self.boxY1.stringValue];
}

I just need to be able to call it after each keypress.. Seems easy enough, no?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:37:06+00:00Added an answer on June 2, 2026 at 10:37 am

    Here’s what I ended up doing:

    I added this:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:NSControlTextDidChangeNotification object:nil];
    

    to the -applicationDidFinishLaunching: method and then, added:

    -(void) textDidChange:(NSNotification *)obj {
       if ([obj object] == self.boxX1) {
          //do stuff
       } else ... {
       // Do other stuff
       }
       ...
    }
    

    to the class.. Worked like a charm!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.