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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:49:52+00:00 2026-05-26T16:49:52+00:00

The context : On my mac app, when i click on a list item,

  • 0

The context :

On my mac app, when i click on a list item, a notification is sent to an object which does something in the background while on the UI there’s a waiting message.
All of this takes place in a window which you can quit by a “Close” button. The button by default is disabled when the notifcation is sent.

What i a want to do is a timeout feature which allows the user to quit this windows after a couple minutes hence enabling the close button.

The code :

- (IBAction)onChangeOperator:(id)sender
{
    [self performSelector:@selector(timerFired:) withObject:nil afterDelay:2.0];
    ....
    ....
    //takes time
    ....
}

-(void) timerFired:(NSTimer *) theTimer {
[close_button setEnabled:YES];
}

The problem :
The button is not enabled until onChangeOperator is finished whereas i want it to be enabled as soon as selector is fired.

I think it’s a thread thingy but i can’t figure out.

  • 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-05-26T16:49:52+00:00Added an answer on May 26, 2026 at 4:49 pm

    From the documentation, performSelector:withObject:afterDelay:

    Invokes a method of the receiver on the current thread using the default mode after a delay.

    So the current thread is still blocked. You should instead run your expensive operation in onChangeOperator on a new thread:

    - (IBAction)onChangeOperator:(id)sender 
    {     
        [self performSelector:@selector(timerFired:) withObject:nil afterDelay:2.0];
        [self performSelectorInBackground:@selector(doUpdates) withObject:nil];
    }
    
    -(void) timerFired:(NSTimer *) theTimer 
    { 
        [close_button setEnabled:YES]; 
    } 
    
    -(void)doUpdates
    {
        .... stuff that takes time....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app which is something of a generic file manager. I would
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
Context: There's an application where you draw things on canvas. Where user clicks there's
I am using the following code: WifiManager wifiMgr = (WifiManager) app.getSystemService(Context.WIFI_SERVICE); return wifiMgr.getConnectionInfo().getMacAddress(); Problem
in my Mac iPhone simulator (iPhone simulator 4.0) i run my app without problem,
I'm building an app for Mac OS 10.6 that will use OpenGL. I'd like
I need to print the content of my view using my mac app. I
I'm trying to replicate an iphone style navbar in my mac app. But I
I am writing a little ASP.NET MVC3 app that I am running on Mac
I'm creating an Mac app that loads some content from a URL in a

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.