cocoa

Making cocoa application scriptable

I am new to cocoa development Can any one please tell me how I can make my cocoa application scriptable. I want my application to perform certain actions,in response to scripts. I could not find easy guide or help. ...

NSButtonCell inside custom NSCell

Hello everybody, in my cocoa application, I need a custom NSCell for an NSTableView. This NSCell subclass contains a custom NSButtonCell for handling a click (and two or three NSTextFieldCells for textual contents). You'll find a simplified example of my code below. @implementation TheCustomCell - (void)drawWithFrame:(NSRect)cellFrame ...

How to overlap (superimpose) an image over a file icon using Cocoa?

I have to make a prototype application where I superimpose a small image over the file icons of a given folder. Let's say I have a folder /MyDocuments/ and there are three files /MyDocuments/Doc1.rtf /MyDocuments/Doc1.pdf and /MyDocuments/Doc1.jpg and I have an image myicon.png, now I have to superimpose this image myicon.png over the fi...

How do I launch a non-document-based Cocoa application by dropping files on it?

The only way I've been able to get this working is with a document-based application (which this app isn't). In my non-document-based application I've defined the supported Document Types (from the Properties tab of the Target info window) and my AppDelegate implements application:openFile: and application:openFiles:. That enables droppi...

Mac OS X: Merge from Database

Hello, I would like to have several custom fields from a (server) database merged into Word Processing documents, beyond the normal "mail merge" fields. I'm not finding anything like an API out of the box that allows you to do this for custom fields. This seems like it would be pretty common in business software, but I assume that's one...

Threaded rendering with NSOpenGLView

Hello, I have an old AGL-based OpenGL windowing system that I am updating to use NSOpenGLView. The engine using it needs to run in its own loop in a separate thread and I am having trouble getting that to work. With AGL, I created the context in the loop thread, so there was no issue, but I'm a little bit confused about the way to do th...

How to get height for NSAttributedString at a fixed width

I want to do some drawing of NSAttributedStrings in fixed-width boxes, but am having trouble calculating the right height they'll take up when drawn. So far, I've tried: Calling - (NSSize) size, but the results are useless (for this purpose), as they'll give whatever width the string desires. Calling - (void)drawWithRect:(NSRect)rect o...

Are there some good examples out there that show how to use Keychain Services in Mac OS X?

I’m not speaking about Apple’s Keychain Services Programming Guide or the Certificate, Key, and Trust Services Programming Guide. The official reference is OK and points you in the right direction, but there aren’t any sophisticated examples I could find. It would be great to have more documentation about how you should handle cerfiticat...

Forcing a text field to end editing Cocoa OSX

I have a view based gui that contains a text field for each gui item. When I select another menu item I want my text fields to exit out of editing mode. I could not find anyway to do this in the nsTextField docs. Any ideas? ...

How to relayout content of NSTextView so that my tab characters are drawn with width of 4 characters

I'm working with an NSTextView and one of the requirements I have is that a tab character, '\t', shall have the same width as four spaces. So the text-content would look like this: AAAA AAAA - 1 tab AAAA - 4 spaces And this is how I accomplish this: // done when NSTextView first loaded and when // delegate's textDidBeginEdit...

Extend iPhoto to post pictures to a different web service?

Currently iPhoto lets me upload pictures to Facebook and Flickr. Is there any way (perhaps write a plugin) to extend this so that I can post photos to a different web service e.g. Picasa? ...

NSDate hours in Cocoa

Hi, I want to calculate the numbers of hours passed on a day from an NSDate object (in UT). Basically, the example should look something like "17 hours and 31 minutes". Thanks! ...

Observer properties of objects in an NSArrayController

I am trying to get the old and new values of the objects in my NSArrayController using KVO. The values passed into the change dictionary are nil though. I have an NSArrayController and I have a class Model with a property name that use cocoa's @property and @synthesize to insure that they are KVO compliant. @property (retain) NSString ...

Casting void* pointer in RubyCocoa

In my RubyCocoa project I am passing a block as a callback function, one of whose parameters is declared as type void *. I know that that the actual type is char *[]. My block is receiving an instance of ObjcPtr but I have been unable to access all elements within the array. The array's size is known, and passed in via another parameter....

Have NSSpeechRecognizer recognize any command

Is there any way I can have NSSpeechRecognizer recognize any command I throw at it. I know I could just have a massive array, but that's too much work and it'll take up a lot of memory. ...

Binding to an NSDictionary's "allValues" array

Am I misunderstanding something about bindings? I bind (an NSArrayController's content) to an NSDictionary's "allValues" array, and it thinks it's empty. I bind to a random object with a property that I've set to be that same NSDictionary's "allValues" array, and it works fine. Is this expected behavior, or am I doing something wrong? F...

NSOutlineView Sidebar help

I'm trying to create a simple sidebar using NSOutlineView..... how would I do this? (I'm using CoreData) ...

Calculate position of NSScrollView relative to main image.

Assume I load an NSImage of dimensions 2000x2000 and display only a portion of the picture inside an NSScrollView with frame size 500x300. How can I calculate the distance between the images 0,0 origin and the views 0,0 origin (so I can determine the x,y coordinates of the view relative to the whole image)? Thanks in advance :-) ...

NSOutlineView and several models

Guys, can somebody point me to sample open source application or tutorial or brief description, how create table view where items grouped by(I think its NSOutlineView, right?). For example, I have products grouped by categories and looking for table which look like this: | Product name | Product cost | -Category1 | product1 name | $10...

Embedded Webkit - script callbacks how?

On windows, when the "Shell.Explorer" ActiveX control is embedded in an application it is possible to register an "external" handler - on object that implements IDispatch, such that scripts on the web page can call out to the hosting application. <button onclick="window.external.Test('called from script code')">test</button> Now, ive ...