nsprogressindicator

Subclass NSProgressIndicator

元气小坏坏 提交于 2019-12-05 08:35:34
i like to subclass a NSProgressIndicator. I've used this code and i set the Subclass in the Interface Builder: - (void)drawRect:(NSRect)dirtyRect { NSRect rect = NSInsetRect([self bounds], 1.0, 1.0); CGFloat radius = rect.size.height / 2; NSBezierPath *bz = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:radius yRadius:radius]; [bz setLineWidth:2.0]; [[NSColor blackColor] set]; [bz stroke]; rect = NSInsetRect(rect, 2.0, 2.0); radius = rect.size.height / 2; bz = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:radius yRadius:radius]; [bz setLineWidth:1.0]; [bz addClip]; rect.size.width

How to use a determinate NSProgressIndicator to check on the progress of NSTask? - Cocoa

家住魔仙堡 提交于 2019-12-04 23:13:52
问题 What I have is NSTask running a long premade shell script and I want the NSProgressIndicator to check on how much is done. I've tried many things but just can't seem to get it to work. I know how to use it if the progress bar is indeterminate but i want it to load as the task goes on. Here is how I am running the script: - (IBAction)pressButton:(id)sender { NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:[NSArray arrayWithObjects:[[NSBundle mainBundle

Adding an NSProgressIndicator to the dock icon

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:37:35
问题 I'm creating an application which should show a progress bar in the dock icon. Currently I have this, but it's not working: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)]; [progressIndicator setStyle:NSProgressIndicatorBarStyle]; [progressIndicator setIndeterminate:NO]; [[[[NSApplication sharedApplication] dockTile] contentView] addSubview:progressIndicator]; [progressIndicator release]; Or must I draw it on the dock

Adding an NSProgressIndicator to the dock icon

徘徊边缘 提交于 2019-12-03 12:51:07
I'm creating an application which should show a progress bar in the dock icon. Currently I have this, but it's not working: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)]; [progressIndicator setStyle:NSProgressIndicatorBarStyle]; [progressIndicator setIndeterminate:NO]; [[[[NSApplication sharedApplication] dockTile] contentView] addSubview:progressIndicator]; [progressIndicator release]; Or must I draw it on the dock myself? Can anyone help me? Thanks. In the finish I had to use the following code as the contentView was

NSProgressIndicator in NSMenuItem not updating on second display

随声附和 提交于 2019-12-02 02:05:31
I've got a NSMenu attached to a NSStatusItem (a menu bar application). While downloading a file I want to display a NSProgressIndicator in an item of this menu. I've created a NSViewController subclass for this progress indicator with the following properties: @property NSUInteger current; // Bound to NSProgressIndicator value @property NSString *status; // Bound to a NSTextField value @property NSUInteger total; // Bound to NSProgressIndicator max value When needed I start the download of the file with the following code, which runs in NSRunLoopCommonModes so that the delegate methods are

Changing the color of NSProgressIndicator?

▼魔方 西西 提交于 2019-11-30 20:39:26
What is the best way to change the color of NSProgressIndicator, is there an easier way than just to subclass it and then draw the whole component by myself? Basically what I want to do is to have a similar component but with the ability to change the color of the bar. I tried to google this but all the questions were quite outdated and didn't really concern the 10.10 OS X version that I am working on. Also checked cocoa controls and did only find 1 component that was for outdated OS X version. paxos You can use Quartz filters (e.g. hue adjust) for this directly in Interface Builder. This

Changing the color of NSProgressIndicator?

一曲冷凌霜 提交于 2019-11-30 05:12:37
问题 What is the best way to change the color of NSProgressIndicator, is there an easier way than just to subclass it and then draw the whole component by myself? Basically what I want to do is to have a similar component but with the ability to change the color of the bar. I tried to google this but all the questions were quite outdated and didn't really concern the 10.10 OS X version that I am working on. Also checked cocoa controls and did only find 1 component that was for outdated OS X

Displaying file copy progress using FSCopyObjectAsync

让人想犯罪 __ 提交于 2019-11-28 20:54:53
It appears after much searching that there seems to be a common problem when trying to do a file copy and show a progress indicator relative to the amount of the file that has been copied. After spending some considerable time trying to resolve this issue, I find myself at the mercy of the StackOverflow Gods once again :-) - Hopefully one day I'll be among those that can help out the rookies too! I am trying to get a progress bar to show the status of a copy process and once the copy process has finished, call a Cocoa method. The challenge - I need to make use of File Manager Carbon calls

Displaying file copy progress using FSCopyObjectAsync

故事扮演 提交于 2019-11-27 13:18:03
问题 It appears after much searching that there seems to be a common problem when trying to do a file copy and show a progress indicator relative to the amount of the file that has been copied. After spending some considerable time trying to resolve this issue, I find myself at the mercy of the StackOverflow Gods once again :-) - Hopefully one day I'll be among those that can help out the rookies too! I am trying to get a progress bar to show the status of a copy process and once the copy process

Long cycle blocks application

巧了我就是萌 提交于 2019-11-26 12:33:13
问题 I hve following cycle in my app var maxIterations: Int = 0 func calculatePoint(cn: Complex) -> Int { let threshold: Double = 2 var z: Complex = .init(re: 0, im: 0) var z2: Complex = .init(re: 0, im: 0) var iteration: Int = 0 repeat { z2 = self.pow2ForComplex(cn: z) z.re = z2.re + cn.re z.im = z2.im + cn.im iteration += 1 } while self.absForComplex(cn: z) <= threshold && iteration < self.maxIterations return iteration } and rainbow wheel is showing during the cycle execution. How I can manage