cocoa - How to stop the animation on a determinate NSProgressIndicator? -
nsprogressindicator allows stopanimation: when isindeterminate == yes, how 1 stop animation determinate progress bars?
for context, progress bar trying child of nsview, view property of nsmenuitem.  sending ridiculously high numbers setanimationdelay: want, temporarily -- when parent menu closed , re-opened, progress bar animated again.
(possibly unnecessary disclaimer: swear legit use case; have able visually (i.e.: without using text) display progress of very-long-running tasks may pause , re-start needed backend. answers boil down "ui design: ur doin rong" not accepted unless accompanied brilliant alternative suggestion. ;) )
subclass nsprogressindicator this, works lion:
@interface unanimatedprogressindicator : nsprogressindicator { @private     bool    isanimating; } @end  @interface nsprogressindicator (heartbeat) - (void) heartbeat:(id)sender;      // apple internal method animation @end  @implementation unanimatedprogressindicator  - (void) startanimation:(id)sender {     isanimating = yes;     [super startanimation:sender]; }  - (void) stopanimation:(id)sender {     isanimating = no;     [super stopanimation:sender]; }  - (void) heartbeat:(id)sender {     if (isanimating)         [super heartbeat:sender]; }  @end 
Comments
Post a Comment