Re: Disable NSSavePanel's New Folder button dynamically?

2010-10-05 Thread Kevin Wojniak
You know, I thought I was using that method all this time, but it seems I was using setCanChooseDirectories: instead, and even my email indicated that. It's been a long morning ;-) Thanks. On Oct 5, 2010, at 11:35 AM, Sherm Pendley wrote: > On Tue, Oct 5, 2010 at 2:17 PM, Kevin

Disable NSSavePanel's New Folder button dynamically?

2010-10-05 Thread Kevin Wojniak
I'm assuming the answer is no, as I've looked over the documentation, but just incase I missed something: is there a way to prevent NSSavePanel's "New Folder" button from being enabled on the fly? For certain volumes, I don't want them to be chosen (which I can already do), but I also don't wan

Re: Disabling selection of files in NSOpenPanel

2010-09-28 Thread Kevin Wojniak
Take a look at panel:shouldShowFilename: On Sep 28, 2010, at 1:14 PM, Dave DeLong wrote: > Hi everyone, > > I'm using NSOpenPanel, and I'd like the ability to disable files and folders > under certain conditions (for example if a file is on an external drive > versus the boot volume). 10.6 i

Re: Subclass NSTableView

2010-09-24 Thread Kevin Wojniak
It's supported, and people have been doing it for years. If you search the NSTableVIew doc page for "subclass" you'll see references to it. On Sep 24, 2010, at 7:50 AM, k...@highrolls.net wrote: > I don't see anything in the docs about subclassing NSTableView. Are there > any known issues in

Re: Controls created at runtime aren't drawn as enabled until a mouse click...

2010-09-09 Thread Kevin Wojniak
Any chance you're using an NSBorderlessWindowMask window? If so, you may need to override canBecomeKeyWindow. Kevin On Sep 9, 2010, at 11:12 AM, Steve Christensen wrote: > I have a window and controls that are loaded from a nib. One of the controls > builds a subview hierarchy to control a se

Re: NSTableView/NSOutlineView variable row height code has detected re-entry.

2010-09-08 Thread Kevin Wojniak
That usually means drawRect: is being called while the table is already inside its own drawRect: method. I've had to deal with this recently. One possible way to find out where it's happening is to subclass your table view and override drawRect:, then setup a counter to check to see if the re-e

Re: UTI for Mach-O file

2010-08-25 Thread Kevin Wojniak
You could just handle all files, then once the file is selected verify it's valid, displaying an error if it's not. See: - - - http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html Kevin On Aug 25, 2010, at 10:46 AM, John Johnso

Re: How to grab content of CALayer and sublayers into a bitmap

2010-07-22 Thread Kevin Wojniak
Depending on your needs, the CGWindow API may do what you want. It can generate images of windows, and then you could crop the image down. But if you're going for transparency that probably won't work. On Jul 21, 2010, at 10:55 AM, Oleg Krupnov wrote: > Hi, > > I need to make a snapshot of a

mach_msg timing out + QuickTime

2010-07-20 Thread Kevin Wojniak
I have a project where there's a plugin that gets loaded into new processes (it's quite hacky) and a controller app that communicates with it via mach messages. I am just fixing bugs with it (didn't originally design it), but there is an issue that is 100% reproducible where a process that uses

Re: Sample code for supporting pinch zoom in Mac OS X?

2010-07-02 Thread Kevin Wojniak
Override magnifyWithEvent: in your view then use -[NSEvent magnification] On Jul 2, 2010, at 1:54 PM, Rick Mann wrote: > Is there sample code demonstrating how to support arbitrary pinch zoom/scroll > in a custom view, on Mac OS X? Similar to how Preview.app does it. > > If not, what about rec

Re: Finder-like conversion of a fileURL to 'user-friendly' path

2010-07-01 Thread Kevin Wojniak
Use -[NSURL path] to get the unix-style path format. On Jul 1, 2010, at 10:29 AM, Rainer Standke wrote: > At the bottom of each finder window there is a 'path' display that indicates > the path to the directory represented by the window. I'd like to be able to > convert a path like this one:

Re: Capturing output from another task with elevated privilages

2010-07-01 Thread Kevin Wojniak
I may be wrong, but I believe AEWP only captures stdout, not stderr, so you could check for that. On Jul 1, 2010, at 7:37 AM, Eric Hoaglin wrote: > Hi all, > > I have the following code: > http://www.pasteit4me.com/763005 > > I'm trying to capture the output of the task that I run. and from w

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-21 Thread Kevin Wojniak
NSURLConnection already does its work asynchronously, there is no need to run it on a separate thread. However if you still want to, you should use [NSRunLoop currentRunLoop], which returns the run loop associated with that thread. In your code you are not creating your objects properly. You sh

Re: The Unadopted Protocol

2010-06-02 Thread Kevin Wojniak
I've used this when compiling code for both 10.6 and below to avoid protocol errors. Seems to do the trick. Kevin On Jun 2, 2010, at 8:57 AM, Matt Neuburg wrote: Here's something I stumbled on by accident. Consider the following: // MyClass.h #import @interface MyClass : NSObject { } @e

Re: six things I wasn't able to do with Cocoa

2010-05-28 Thread Kevin Wojniak
Did you try QTMovieNaturalSizeAttribute? http://developer.apple.com/mac/library/technotes/tn2005/tn2138.html#TNTAG11 On May 28, 2010, at 9:43 AM, Bill Appleton wrote: > Hi Chaitanya, > > that code always returns a size of 100, 100 for every movie I try. really. > > and then the poster or fram

Re: six things I wasn't able to do with Cocoa

2010-05-28 Thread Kevin Wojniak
On May 27, 2010, at 12:43 PM, Bill Appleton wrote: > *4)** **I **can't call the printing code* > > I know, the printing code calls me. But other platforms don't work like > this. I eventually used Core Printing and the Cocoa dialogs by sub-classing > and faking out NSPrintPanel. Is there a bette

Re: How to setup idle timer in 64-bit 10.6?

2010-05-10 Thread Kevin Wojniak
CGEventSourceSecondsSinceLastEventType() is what you want. See here: http://www.noodlesoft.com/blog/2008/01/08/idle-hands/ On May 10, 2010, at 1:26 PM, Marc Respass wrote: > Hi All, > > My application has a requirement that it "locks out" the user after X minutes > of inactivity. I was using U

Re: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...

2010-04-18 Thread Kevin Wojniak
On Apr 17, 2010, at 5:29 PM, Ken Thomases wrote: > On Apr 17, 2010, at 6:46 PM, James Bucanek wrote: > >> How do I get the mount point path of a freshly mounted volume in Snow >> Leopard? >> >> In Leopard (10.5), the NSWorkspaceDidMountNotification included an >> NSDevicePath value. It contai

Re: How to force a 32-bit/64-bit universal app to start in 32-bit mode on Leopard?

2010-04-08 Thread Kevin Wojniak
Not sure if it's needed, but you may need to run touch on the .app. On Apr 8, 2010, at 8:59 AM, Oleg Krupnov wrote: > No, I'm just double-clicking it in Finder. > > On Thu, Apr 8, 2010 at 8:57 AM, Kevin Wojniak wrote: >> Are you launching with NSTask or some other var

Re: How to force a 32-bit/64-bit universal app to start in 32-bit mode on Leopard?

2010-04-08 Thread Kevin Wojniak
Oleg Krupnov wrote: > This would be a perfect solution, but I've found that on Leopard, this > key seems to be ignored, the system still launches my app in 64-bit > mode (via Finder). > > What may I be doing wrong? > > Thanks! > > On Thu, Apr 8, 2010 at 7:28

Re: How to force a 32-bit/64-bit universal app to start in 32-bit mode on Leopard?

2010-04-08 Thread Kevin Wojniak
In your Info.plist add: LSMinimumSystemVersionByArchitecture x86_64 10.6.0 Kevin On Apr 8, 2010, at 7:21 AM, Oleg Krupnov wrote: > Hi, > > While it's good for my app to run in 64-bit mode on Snow Leopard, it > turns out not desirable on Leopard, because of the delay of load

Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Kevin Wojniak
Yep, you're right. I built against 10.5 SDK and got the same problems. On Apr 5, 2010, at 5:06 PM, Sean McBride wrote: > On Mon, 5 Apr 2010 15:02:49 -0700, Kevin Wojniak said: > >> Including it isn't enough, you still need to link it with your other >> framewo

Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Kevin Wojniak
5, 2010, at 3:31 PM, Kevin Wojniak wrote: > >> Looks to me like it's still available for x86_64. Are you linking with the >> CoreServices framework? >> >> Kevin > > > Yeah, I've got: > > #include > > void foo() { >UpdateSystemAc

Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Kevin Wojniak
Looks to me like it's still available for x86_64. Are you linking with the CoreServices framework? Kevin On Apr 5, 2010, at 12:36 PM, Andy O'Meara wrote: > > Hey cocoa crew, quick question... > > I'm looking for a Cocoa replacement for Carbon's UpdateSystemActivity() since > it appears to b

Re: Odd crash

2010-03-22 Thread Kevin Wojniak
I've seen this crash plenty of times as well. Hopefully it'll be fixed in 10.6.3. On Mar 21, 2010, at 4:40 PM, Kyle Sluder wrote: > On Sun, Mar 21, 2010 at 3:37 PM, Graham Cox wrote: >> I got this crash report from a user. It seems to be an isolated incident but >> it would be good to know wh

Re: Case sensitive fileName

2010-03-17 Thread Kevin Wojniak
These two methods worked for me: NSString *path = @"/FOLDER/FILENAME.txt"; NSLog(@"displayNameAtPath: %@", [[NSFileManager defaultManager] displayNameAtPath:path]); FSRef ref; HFSUniStr255 name255; if (!FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &ref, NULL) && !FSGet

Re: Clicking on an NSColorWell

2010-03-12 Thread Kevin Wojniak
Subclass and override mouseDown: - however if you're trying to intercept right before the color panel is shown, or a drag starts, that may be trickier. What are you trying to do generally? On Mar 12, 2010, at 1:30 PM, Jonathon Kuo wrote: > How can I intercept or get notified when a user clicks

Re: .ini file class?

2010-03-12 Thread Kevin Wojniak
You could write a Cocoa wrapper around an existing C/C++ library. For example http://ndevilla.free.fr/iniparser/ On Mar 12, 2010, at 10:34 AM, Fritz Anderson wrote: > It should be easy to write an Objective-C class that reads and writes .ini > files, but I'd prefer to use existing art if any e

Re: calling the run method in an AppleScript from a cocoa application

2010-03-12 Thread Kevin Wojniak
Hey Dave, I think this may be what you want: http://homepage.mac.com/kenferry/software.html#KFAppleScript Kevin On Mar 12, 2010, at 8:56 AM, David Alter wrote: > I need the ability to call an AppleScript from a Cocoa Application. I have > done this in the past using NSAppleScript and it works

Re: Accessing the contextual menu of a QTMovieView?

2010-03-10 Thread Kevin Wojniak
Have you tried subclassing QTMovieView and overriding menuForEvent: ? On Mar 10, 2010, at 2:29 PM, John C. Randolph wrote: > I'd like to add an item to the menu that comes up when you right-click on a > QTMovieView. I want to copy the URL of the movie it's showing into the > pasteboard. I'm n

Re: [NSTableview] can't make selected text stay black

2010-03-08 Thread Kevin Wojniak
What about overriding the drawTitleXXX method and just draw the text yourself? On Mar 8, 2010, at 3:15 PM, Kent Hauser wrote: > On Mon, Mar 8, 2010 at 12:20 PM, Corbin Dunn wrote: > >> >> On Mar 5, 2010, at 2:25 PM, Kent Hauser wrote: >> >>> Hi, >>> >>> I'm trying to make a NSTableView sele

Re: Creating NSOutlineView programmatically

2010-03-08 Thread Kevin Wojniak
You may need to use setOutlineTableColumn: method to set the outline column specifically. On Mar 8, 2010, at 1:07 PM, Zack Bartel wrote: > Hi Everyone, > > I am trying to create an NSOutlineView programmatically inside of an > NSDrawer. I am using the example datasource from > /Developer/Exa

Re: Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Kevin Wojniak
Never mind, ignore that. Use drawInRect instead of drawAtPoint. My guess is that when when you draw at a point, Cocoa obviously doesn't have a boundary to right (or center) align the text to, so it just defaults to left-aligned. On Mar 8, 2010, at 12:36 PM, Kevin Wojniak wrote: > Y

Re: Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Kevin Wojniak
You could try using -[NSMutableAttributedString setAlignment:range:] On Mar 8, 2010, at 12:27 PM, Neil Clayton wrote: > > Hello All! > > I seem unable to align text when drawing using drawAt:point. The NSTextView > shows it OK (so the attributes appear correct), but drawing of the text > do

Re: XCode's Special Buttons

2010-03-01 Thread Kevin Wojniak
It's probably an NSPopUpButton subclass, with a custom NSPopUpButtonCell subclass to change its appearance. I don't think IB lets you create custom popup buttons that small, so you'd probably have to either use a standard button or a custom view, and then set the class name and finish up any oth

Re: Sheet not appearing normally...the first time

2010-02-23 Thread Kevin Wojniak
See if the Visible at launch checkbox is enabled in the nib for your window. If so, turn it off. Kevin On Feb 23, 2010, at 1:05 PM, Jean-Henri Duteau wrote: > I have built a document-based application that brings up two sheets. I > followed Apple's NSPersistentDocument sample app. For the f

Re: Best practices for using standard window widgets in a custom window

2010-01-22 Thread Kevin Wojniak
ens Alfke wrote: > > On Jan 20, 2010, at 9:43 AM, Kevin Wojniak wrote: > >> NSWindow's standardWindowButton:forStyleMask: method works great for >> creating these buttons and adding to my custom (frame) view. However, the >> mouse over effect does not

Best practices for using standard window widgets in a custom window

2010-01-20 Thread Kevin Wojniak
I have a custom window (NSBorderlessWindowMask) that requires using the standard close/minimize/zoom buttons. NSWindow's standardWindowButton:forStyleMask: method works great for creating these buttons and adding to my custom (frame) view. However, the mouse over effect does not work without us

NSViewAnimationFadeInEffect broken in Snow Leopard?

2009-12-22 Thread Kevin Wojniak
NSViewAnimationFadeInEffect doesn't seem to be working like it was in Leopard. Here's an older project (not mine) to test: http://www.noodlesoft.com/blog/2007/09/03/animation-in-the-time-of-tiger-part-2/ When fading from one view to another, the fade out works, but the fade in doesn't. The view

Default authorization dialog text in Snow Leopard misleading

2009-09-03 Thread Kevin Wojniak
In Snow Leopard, the default dialog text is now "Type your password to allow MyApp to make changes." In Leopard it was "MyApp.app requires that you type your password." The SL version is slightly misleading, at least from a user's perspective. In our app we aren't making any direct changes,

Scripting Bridge and System Events

2008-12-26 Thread Kevin Wojniak
I am trying to write a method to set the Desktop picture using Scripting Bridge and System Events. Header is generated via: sdef /System/Library/CoreServices/System\ Events.app | sdp -fh -- basename SystemEvents The working AppleScript is: set picture of desktop 1 to POSIX file "/Some/file

Re: NSApplication subclass crashes on 10.3 with Xcode 3

2008-09-17 Thread Kevin Wojniak
wrote: On Wednesday, September 17, 2008, at 10:06AM, "Kevin Wojniak" <[EMAIL PROTECTED] > wrote: Well it works fine on 10.5 without any autorelease warnings, and nothing shows up in 10.3's Console either, so I don't think that's the issue. Its as if the Coco

Re: NSApplication subclass crashes on 10.3 with Xcode 3

2008-09-17 Thread Kevin Wojniak
it sequence. Or, do the initialization in the app delegate in the applicationDidFinishLaunching: message. That's the best solution. On Sep 16, 2008, at 8:18 PM, Kevin Wojniak wrote: @implementation MyApp + (void)initialize { NSLog(@"MyApp initialize!"); NSDictionary *dict = [NS

NSApplication subclass crashes on 10.3 with Xcode 3

2008-09-16 Thread Kevin Wojniak
I'm working on an app that was recently brought over to Xcode 3 from a 2.X version. The app uses an NSApplication subclass that's in a framework, and crashes upon startup on 10.3 when using the Xcode 3 build. However, with Xcode 3/10.5 and Xcode 2.5/10.3, it works. I've successfully duplica

Re: NSMutableArray removeObject: crash

2008-04-04 Thread Kevin Wojniak
lf used at time of posting the notification)? -Shawn It is showing up as KERN_INVALID_ADDRESS. I don't release "self" until after (not immediately) the notification is sent. On Apr 4, 2008, at 4:21 PM, Hamish Allan wrote: On Fri, Apr 4, 2008 at 9:08 PM, Kevin Wojniak &l

NSMutableArray removeObject: crash

2008-04-04 Thread Kevin Wojniak
I am getting a report of a crash with a stack trace ending like this: 0 libobjc.A.dylib 0x92d066f9 objc_msgSend + 41 1 com.apple.CoreFoundation 0x96d4b720 -[NSMutableArray removeObject:] + 96 Generally, when there are specifics like this I can