I am trying to use NSProgressIndicator (undefined) inside the status menu. I use an NSView object as a view for a menu item, and then look at the progress bar to display it. But whenever I try to call startAnimation: nothing happens to progress. When I try to do the same in a regular NSWindow, it only works fine when inside a menu item.
I am new to both cocoa and objective-c, so I might have missed something βobviousβ, but I was looking for quite a bit to work around, but to no avail. I found something about the fact that menu items cannot be updated while they are showing, and that you need to use a limitless window instead. But I could not confirm this in any documentation.
Edit:
OK, it almost works now. When using setUsesThreadedAnimation: and from the MenuDelegateWillOpen menu and creating a new stream. This thread executes the local method:
-(void) doWork(NSProgressIndicator*) p{ [p startAnimation:self]; }
When you open the menu, this will begin to indicate the progressinicator on a random (?) Basis. If I call startAnimation: directly without passing doWork: (still using the new thread), it never works. Does setUsesThreadedAnimation: progress bar make its own thread for animation?
objective-c cocoa nsview nsmenuitem nsprogressindicator
Henrik
source share