First question in StackOverflow and also Cocoa newbye and in addition I am using XCode 4 (so be kind please!)
Scenario:
A simple NSPersistentDocument Multi-windows: each document have a window.nib and an attached WindowController The application RUN a NSTask (in background) when I press a button in the WINDOW TOOLBAR.
In the window (inside a View) I decided to put a nice NSProgressIndicator (indeterminate) that animate when task start and stopAnimation when task end (I collect task messages trough Notifications).
Sample Code:
NSButton --> IBAction --> method in the WindowController
- (IBAction)launchSim:(id)sender
{
[simcell launchTask];
[progBar startAnimation:self];
.... more code ...
}
Everything works nice and perfectly.
Now (as usual in this scenarios) you get a strange bug and you start to become unproductive:
I decide to run the same Action also from the MainMenu (from an NSMenuItem):
In the MainMenu.xib:
NSMenuItem ("RUN") --> FirstResponder --> User Defined Action in First responder:launchSim (type id)
The RUN menu item run correctly the Task (I have NSLog DEBUG messages) BUT the animation (startAnimation) of the progressBar don't start!
THe DIFFERENCE in the 2 Actions:
- the first one (working) is called from the Nib file owned by the WindowController
- the second one (not working) is called from the MainMenu.xib and sent to FirstResponder
Both the actions execute correctly the other part of code in the method, but if I call the action from the menu I can't see any animation of the progress indicator.
What I missing?
Thanks and Best Regards