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

  • Home
  • SEARCH
  • 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 9016065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:54:05+00:00 2026-06-16T03:54:05+00:00

In a program I am working on I am performing a large amount of

  • 0

In a program I am working on I am performing a large amount of data crunching, and want to be able draw a custom NSView to represent the process visually.

The data crunching is processed off the main thread by using GCD (using dispatch_sync as the order needs to be preserved):

for (int i=0; i<iterations; i++) {

    dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        // Add a data crunching task to the queue!
    });
}

When the processing is started I initialise a timer, which is used to ask the custom display to redraw at regular intervals (this timer is invalidated once all of the processing tasks are completed):

-(void)onTick:(NSTimer *)timer {

    [_customView setNeedsDisplay:YES];
    // Update some other UI object (labels etc.)    
}

I have this working as expected, however the only problem I notice now is that if I do something like click and hold on a button on the same window, or begin dragging a slider while the process is going on, the redrawing of the custom view is prevented until I let go of the mouse!

Is there any way I can prevent this from happening, preferably without moving all of the controls onto a separate window!

  • 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-16T03:54:06+00:00Added an answer on June 16, 2026 at 3:54 am

    yip the timer is on the runloop and while in the drag drop / tracking mode it doesnt get fired because the runloop isnt advanced for the common mode

    add it to the modes needed:

    NSRunLoop *runloop = [NSRunLoop currentRunLoop];
    NSTimer *timer = [NSTimer timerWithTimeInterval:0.1 target:self selector:@selector(myTimerAction:) userInfo:nil repeats:YES];
    [runloop addTimer:timer forMode:NSRunLoopCommonModes];
    [runloop addTimer:timer forMode: NSEventTrackingRunLoopMode];
    

    edit: the runloop is basically apple’s while loop for dispatch ANY event to an app. and it filters the events it dispatches based on so called modes.

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

Sidebar

Related Questions

Background: I am writing a C++ program working with large amounts of geodata, and
I have a working program in C++ that generates data for a Mandelbrot Set.
is there any small working program for recieving from and sending data to client
I have a very old, very very large, fully working, C program which plays
I'm working on a C program where I want to user to type the
I am working on a C# program that reads in very large files and
how can i make java program working with multiple languages (frensh, english , arabic
Having successfully gotten a sample program working, I'm now starting to do Real Work
I'm trying to get a simple winsock program working, so I create my socket
I'm trying to get a helloworld type program working with REST CI/jquery. I've included

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.