Cocoa freezes during function

deliciousMammal

Registered
OK, this isn't real important, but I was just wondering if anyone here who know objective-c/cocoa could tell me how this works.

I have a program that is supposed to update a NSTextField to tell the user what the program is currently doing and also to update a NSProgressIndicator to show how far along it is, but when it is run nothing changes for the entire function and when it finishes it sets the text field to the last update I made in the function. Is there a way around this, or is it just how things work?
 
We'd probably need to see the function or method :)

How is the method triggered, and what does it do except besides displaying its status?
 
If you want a control, like a progress bar, to update in the middle of a function, you need to call it's -display method. Otherwise it will just update the next time through the event loop. Calling -display manually is considered bad form, but...well, it works, and it's probably easier than rewriting your program to either use threads or drop back into the main event loop continually.

Of course, this is just a guess. Without seeing your code, I can't say for sure.
 
Also remember that all you GUI stuff need to be on the main thread, if you are tying that thread up with a long function it will freeze the GUI until you finish.
 
Back
Top