cocoa

Triggering a method when a row in a Table View is edited.

Is there a way to trigger a method (or a method its self which is triggered) when a Row in a is edited, more specifically, when text in a row is edited or when something changes in the Table View (e.g Row Added/Removed)? ...

Dimming NSWindow and layer NSView on top

Is there any way I could dim my NSWindow (basically putting a black transparent layer over top of it that you cannot click through) and then layer a custom NSView on top? ...

NSCollectionView in 10.6/Xcode 3.2

Hey there, in Xcode 3.1.2 I used to load the nib of the NSCollectionViewItem in my subclass of NSCollectionViewItem like this: -(id)copyWithZone:(NSZone *)zone { id result = [super copyWithZone:zone]; [NSBundle loadNibNamed:@"PersonView" owner:result]; return result; } In Xcode 3.2 under 10.6 the same method doesn't ...

Can you programatically look up a word in the Mac OS's built-in dictionary?

I'd like to have a program of mine retrieve a definition of a word. Is there a way to access the built-in dictionary using Objective C? (i.e. the one that Dictionary.app and command-control-D use) Thanks! ...

I want to switch button image on click.

I want to change the image of button on click. click once 1 image should be set on he button and when again clicked the 2nd image should be there and these images should switch on click. ...

Adding a subscription to iCal via Cocoa

Hello, I'd like to add a subscription in iCal like it does itself with Address Book: Address Book provides iCal with the birthdays of my contacts. I would like to add something like that to iCal: I want to calculate Eastern and depending holidays and have iCal pull these dates from my program. Does anyone have ideas for Cocoa APIs on w...

Extending to list FileSize?

I am just learning Objective-C / Cocoa and I am a little unsure how I might extend my code to display the size of the files found. EDIT 2 I have taken the comments from SMorgan & Peter below and worked them into the code ... comments most welcome. // ------------------------------------------------------------------- ** // DISC: FILE...

How to obtain the selected text from another application?

I will soon be working on an application which needs to get the currently selected text in the frontmost application window, be it Safari, Pages, TextEdit, Word, etc., and do something with that text. My goal is to find a solution that works with as much applications as possible. So far I thought about using AppleScript, but that would ...

Saving a NSArray.

I would like to save an NSArray either as a file or possibly use user defaults. Here's what I am hoping to do. Retrieve already saved NSArray (if any). Do something with it. Erase saved data (if any). Save the NSArray. Is this possible, and if so how should I do this? ...

Spotlight NSMetaDataQuery with invisible items do not auto update

The original search runs fine, but any changes to invisible items go unnoticed by the query. The query can be ran again and it will find the updates. The query is non-nil and spotlight notifications have not been unsubscribed. Is this a bug or expected behavior? I have tested this several times in a few different projects and it seem...

Defining NSMutableString?

My understanding is that both of these create a NSMutableString, only the first one is owned by the system and the second one is owned by me (i.e. I need to release it). Is there any particular reason why I should use one or the other, on the face of it it seems easier to use the first? Also is the first better as it gives the compiler a...

cocoa + .app file

Hi guys i have an executable for my cocoa application as xyz.app file. But when i copy this on windows, it is showing this as a directory with all the resource files and stuff. Is there any way to create a single file executable on mac also (like .exe file on windows) so as to disable the user from seeing the resource files and other fi...

Is this the right way to create / destroy string in loop?

Just curious if this is the way to do this, just want to make sure its not leaking, although I would think I am only modifying the string contents. NSMutableString *newPath = [[NSMutableString alloc] init]; for(fileName in [manager enumeratorAtPath:rootPath]){ if ([[fileName pathExtension] isEqual:@"exr"]) { [fileArray addO...

Determine the number of months between two dates using Cocoa

Hello, How do I calculate the number of months between two dates using Cocoa? Thanks, Stan ...

Mac HUD window in Qt

I am trying to create a HUD that is an NSPanel in Qt. I am using QMacCocoaViewContainer as suggested in the qt documentation. In HUD.h #import <QWidget> #import <QMacCocoaViewContainer> class HUD : public QMacCocoaViewContainer { public: HUD(QWidget* parent); }; In HUD.mm #import "HUD.h" #import <Cocoa/Cocoa.h> HUD::HUD(Q...

Xcode NSRunningApplication Terminate

Hey Everyone, I have this code: NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace]; NSString *appPath = [sharedWorkspace fullPathForApplication:appName]; NSString *identifier = [[NSBundle bundleWithPath:appPath] bundleIdentifier]; NSArray *selectedApps = [NSRunningApplication runningApplicationsWithBundleIdentifier:identi...

stringByAppendingPathComponent, hows it work?

EDIT_v002 I have had a look at all the comments and I am starting to see what I should be doing. To that end I have modified my code (see below) I have changed newPath to a NSString, removed the [[alloc] init] and the end [release] as its now handled by the system. I am using stringByAppendingPathComponent, letting it add a separator be...

I want a beautiful custom window for my first cocoa app

Hi! I'm a graphic designer - turned web designer - turned web developer - who is currently trying to turn into a mac developer. I've nearly done programming my first app. Is a very, very simple application but I'm happy because I'm learning a lot of new stuff. The problem is: I don't like how it looks. As you may guess, design is a ver...

NSImageView empty in WebKit plugin

I'm writing a webkit plugin that downloads an image and prints it.I have verified that the correct data is downloaded and the NSImage has the correct dimensions. Unfortunately, the NSImageView containing the image doesn't display anything, neither in the document sent to the printer nor a window containing the view as it's content view's...

mouse click events in an NSView subclass

Hello, I have an NSView subclass that gets initialized with an OpenGL context and has a bunch of mouse event handling (onMouseDown, etc...). I have an app using it which has a main Cocoa window that contains the view and all the mouse events are working properly. However, I'm trying to use it now in another app where i have a secondary...