cocoa

Design strategy advice for defining machine system functionality

This question relates to project design. The project takes an electrical system and defines it function programatically. Now that I'm knee-deep in defining the system, I'm incorporating a significant amount of interaction which causes the system to configure itself appropriately. Example: the system opens and closes electrical contact...

Cocoa's NSView getting insane mouseDown events ?

Hullo all - I've got a NSView subclass that I move programmatically on mouseDown. Which works, but has an odd side effect: I click the subview. The subview moves away [GOOD] I wait a while. I do not move my mouse. Since the subview has moved it's no longer under my cursor. I click my mouse again. I expect the underlying window to get ...

Play QT movie located in application bundle

I'm trying to run a QT Movie located in my application bundle. Can't get it to work. Can someone advise? thanks. paul -(IBAction)runInternalMovie:(id)sender [ NSString *internalPath; NSURL *internalURL; QTMovie *internalMovie; internalPath = [[NSBundle mainBundle] pathForResource: @"bundledMovie" ofType: @"mp4"]; internalURL = ...

AppDelegate file missing in Xcode 3.1 ?

i am currently starting to learn Xcode and objective-c and i am reading three different books on that topic currently. All of these books refer to a file called "AppDelegate" (My_First_ProjectAppDelegate.m, My_First_ProjectAppDelegate.h) which are said to be "created with the Project" (i am creating a "Cocoa Application"). These files ar...

How to register user defaults using NSUserDefaults without overwriting existing values?

I have an AppDelegate class with +(void)initialize method that I use to register some defaults. Here's the code that I use: + (void)initialize { NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys:@"NO", @"fooKey", @"YES", @"barKey", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; } I also...

Contextual Menu Item development for OSX (Leopard and Snow Leopard)

i was wondering what the best practice is for creating a contextual menu item that would work in both leopard and snow leopard and works with a selection of files and/or folders, sending them to a shellscript. i know that the contextual menu items have been deprecated in SL - but does that mean there is no way to create a solution that...

NSTokenField autocomplete

Hi, I'm creating an application which uses an NSTokenField. I need autocompletion. I'm using an NSURLRequest to request data from http://stackoverflow.com/filter/tags?_=&lt;timestamp&gt;&amp;limit=6&amp;q=&lt;str_to_autocomplete&gt;&amp;timestamp=&lt;timestamp&gt; Where <timestamp> is the current timestamp, an <str_to_autocomplete> is ...

Property Grid for Cocoa

I didn't find anything similar to .NET PropertyGrid class in Cocoa, so I started to write my own version. I use information from runtime to get properties of object: Class reflectedClass = [reflectedObject class]; uint propertyCount = 0U; objc_property_t *properties = class_copyPropertyList(reflectedClass, ...

Attaching Files to PDFs?

PDF files can contain attachments (see here). This is useful when you need machine-readable data (e.g., XML) to be associated with a human-readable PDF. Does Cocoa's PDFKit support adding file attachments to an existing PDF? I'm looking through the documentation and I don't see anything. ...

Algorithm to implement a lasso selection tool?

I am developing a Mac OS X application which, as part of it's UI, will display many visual elements in it's main view which can be selected. These elements can be positioned really anywhere within the view. The UI will support various ways of selecting the elements: rectangular marquee selection, elliptical marquee selection, and 'free' ...

Circular Linked List in Cocoa

Is there something similar to a circular linked list available in Cocoa? I know that an NSArray is ordered - but I don't think I can use 'nextItem' or 'previousItem' - correct? Furthermore, I need the nextItem of the last item to be the first item. I could add my own nextItem and previousItem methods, but I'm surprised if Apple have...

Close calls take forever using Cocoa's asynchronous IO?

I am writing a single threaded Cocoa app and am attempting to use the NSNotificationCenter utility methodology (as that seems to be how things are done in cocoa) to do non-blocking IO. Everything seems to work fine except for when the file handle is closed. It eventually notifies me, but it takes forever. Can anyone explain why this w...

How to optimize callbacks from a NSOperationQueue-started thread

Consider this: @interface SomeViewController : UIViewController { SomeChildObject *child; } @end @implementation SomeViewController - (void) viewDidLoad { ... child.delegate = self; } - (void) somethingHappened { NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:child sel...

in cocoa,Aout serial communiction using nsfilehandle issues .

i have a software about serial communication , it to be develop in MAC os=10.5.8 using cocoa 's nsfilehandle , test ok , but when MAC os upgrading to 10.6 ,the program work no normal, can't receive nsfilehandle's notification . it's why , ...

Where can I find a list of key codes for use with Cocoa's NSEvent class?

I'm looking for a comprehensive list of the available key codes that can be used with Cocoa's NSEvent class. The NSEvent class has a keyCode property, which is defined as unsigned short. The following code, when placed in an appropriate UI object, will echo the key codes as they are pressed: - (void)keyDown:(NSEvent *)theEvent { NSL...

MainMenu.xib with dispositioned main window

Each time I create any type of cocoa project (document-based, with core-data and/or spotlight importer) and open MainMenu.xib, I get a warning sign in bottom right object palette window corner saying that window is out of screen bounds. Why is this so? Any remedy? ...

Property Editor Control for Cocoa?

Is there any Cocoa Widget which i can use to build a typical (well except in Interface Builder) GUI builder property inspector like RealBasic or Delphi has? And is there a website where additional 3rd party Cocoa widgets are listed? ...

Detect SSD in Mac OS X (Cocoa)

Is there a reliable, quick, deterministic way (definitely not benchmark) to check whether system drive in Mac OS X is on Solid State Drive? Is there any other indicator how well disk handles parallel access? I'm trying to adjust number of threads that my program is going to use for disk-bound operations. I'm not interested in raw spee...

How to control a NSView, located in a dedicated NSWindow, from the main NSWindow designed to support the GUI built under COCOA?

Hi, This is probably a simple problem for the high skilled Cocoa programmers, but I can't find how to control the graph in a separate window. I read carefully the Cocoa related books, go through many web notes,but I can't find a solution to my problem. The purpose is to use a dedicated window to draw the I=F(Vg) curves extracted by the ...

How do I model relative scores between entities in CoreData

I am new to CoreData and am struggling to work out the correct way to model a particular relationship. I have an entity called 'Friend' with a few attributes such as 'name', 'age', 'sex' etc. I would like to be able to model a score between two instances of Friend and am having trouble getting my head around the best way to do this. Fo...