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 8670489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:43:05+00:00 2026-06-12T18:43:05+00:00

I am running a lengthly task in an Action and I would like to

  • 0

I am running a lengthly task in an Action and I would like to have a display of where I am at. For that I created a Text Field and I tried it with setStringValue:

[textField setStingValue: [NSSting stringWithFormat:@"%ld",currentValue]]

The code works but unfortunately it is not updating the NSTextField after every iteration but rather when the whole Action is done.

What am I doing wrong?

  • 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-12T18:43:06+00:00Added an answer on June 12, 2026 at 6:43 pm

    This is because applications with the Cocoa framework use an event loop to perform operations, and events occur in a completely serial fashion.

    An event is basically any kind of action that the framework designer could not predict or found convenient to have run in a delayed manner. Since you can’t predict when clicks will be performed, they need to be considered events; and for efficiency reasons (since you don’t want to repaint a component multiple times if you don’t need to), the repaint actions are events too.

    Your action runs in response to a user event (for instance, a click on a button is an event) and therefore blocks all other events waiting in the queue until it’s complete. However, components are repainted in response to a different, framework-triggered event, and as such the text field must wait until your action completes to repaint itself. This is why you cannot visually change the value of a text field from inside an action.

    In order to notify your user of the progress of your task, you’ll need to run it on a different thread. There’s a lot to say about threads, so you should probably read some about them. I’m also sure that there are plenty of examples of how to run a long action in a background thread and update the UI accordingly for Cocoa all over the Internet.

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

Sidebar

Related Questions

Running SQL Server 2008 (not R2). I have a few reports that have URLs
I have a lengthy stored procedure in which I would like to do something
Running my script through Devel::NYTProf showed that the following portion of code took up
Running rails 3.2.3 with guard/spork/rspec/factory_girl and have the following in my spec helper: Spork.prefork
I seem to be going round in circles. I have a WPF application that
I have a long-running process where, due to a bug, a trivial/expendable thread is
I have an ASP.Net application running under IIS 6. A simple page has two
I have a Windows service that has a number of threads that all need
I have a VPS running a VPS optimized Debian distro. I am very new
When I'm running (multiple) lengthy custom actions, can I update the GUI's status text

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.