cocoa

Globally monitoring NSMouseMoved returns NSMouseUp

I'm trying to register the NSMouseMoved event globally using this line of code: [NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMoved handler:mouseMovedBlock]; However, my mouseMovedBlock only gets called when the mouse gets clicked and not when the mouse is moved. I tried detecting the type of the NSEvent and it returns NSMouse...

Adding NSMutableDictonary to NSMutableArray but objects being replaced

How come whenever I add a new object NSMutableDictionay to my NSMutableArray it replaces my previous object? For example: [appDelegate.tracksDict setObject:currentTrackTitle forKey:@"track_title"]; [appDelegate.tracksDict setObject:currentTrackTopic forKey:@"topic"]; [appDelegate.tracksArray addObject:[appDelegate.tracksDict copy]]; ...

Authorization and NSMetadataQuery

Hi, I'm trying to use NSMetadataQuery to read in restricted directories and I've encountered some problems: I followed the apple documentation to acquire privileges but the result of the query is empty (while I know it shouldn't). Here's the code I wrote: AuthorizationRef myAuthorizationRef; OSStatus myStatus = AuthorizationCreate(...

My Cocoa program won't run on an Intel Core Duo

I am compiling and running my app fine on a new core i5 system. However, when I try to run it on a core duo it doesn't work. At first Mac OS would refuse to run it, but then I turned off "build for active architecture only" in XCode and cleaned and rebuilt the app. Now the app seems like it's starting (the icon does the getting bigger t...

Cocoa dot syntax without variable.

Hey guys, I just wrote a setter and getter method in apples format. There is no variable for it but I noticed I could use the dot syntax. Am I crazy? Does this actually work? Could someone explain exactly what lets you use the dot syntax? // Here is my header definition. Keep in mind there is no class variable or @property for texture. ...

NSOutlineView with badge of unread messages like Mail.app

I'm trying to create a user interface similar to the iTunes source list or the Mail.app mailbox list where a badge with a number (e.g. unread emails, new podcasts) is shown at the right hand side of an element. Based on Apple's SourceList example, I have an NSOutlineView set up to display a couple of groups and a few items in each group...

Can you use KVO with Scripting Bridge

Can you use KVO with Scripting Bridge? I want to know if I can make an Scripting Bridge interface for my application and allow client applications to be notified by observing an object returned by one of my app's SB commands. Is this possible? If not, what's an alternative? ...

NSMutableDictionary not taking key/value pair

Hi all, so here I am stuck at the simplest part (or so I thought) of my small project for this morning. The goal was to build a simple XML Parser who takes every element they encounter and add it to a dictionary that will eventually hold all key/value pairs of the xml. So an xml like this <xml> <1stTag>text</1stTag> <2ndTag>some m...

Good resources to learn MacRuby

I do not know Ruby and I am interested to learn MacRuby. What would you recommend as your best resource (books, blogs, sites) to learn MacRuby? Found:http://www.macruby.org/ ...

How to give a view focus when my app launches?

Hi, how can I choose the view which is active when I start my app? I searched in the Interface Builder but found nothing. Perhaps there is a chance like [view setActive]? so long ...

Array is empty after calling method

Hi, everytime I call the method -(void)setArrayCheckOut:(int)num in another class the array arrayCheckout is empty. Calling -(IBAction)reloadTable:(id)sender after -(void)setArrayCheckOut:(int)num "results in reload table - (null), 0". Any idea what goes wrong? so long @implementation CheckOut -(id)init { [super init]; tableCheckOu...

How can I make my app more responsive?

Background This is the same background as my previous question, except the Outline view doesn't have a fetch predicate. I've got an NSOutlineView that shows TrainingGroup entities. The NSOutlineView is bound to an NSTreeController In the NSTreeController, I've got "Preserve Selection" ticked and "Select inserted objects" unticked. Ea...

Show contextual menu on ctrl-click/right-click on header of NSTableView

Hi, I'm searching for an elegant way to detect a right-click/ctrl-click on the header of an NSTableView. When the right click occurs, I want to display an contextual menu. - (NSMenu *)menuForEvent:(NSEvent *) detects only right clicks in the table - not in the header of the table. thanks for your help. ...

Problems understanding authorization

Hi everybody, I'm having problems in understanding how to authorize my program to perform privileged tasks. I read the apple documentation and wrote this piece of code: AuthorizationRef myAuthorizationRef; OSStatus myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &myAuthorizationRef); Au...

Dragging from and to NSButton

I am trying to write an app. that will allow the user to drag from an NSButton to another. When dropped I would like the Title to be dropped onto the button. I cannot find a way to make NSButton draggable. Is it possible? ...

CoreData referencing

My application is CoreData based but they may be a common theory for all relational databases: I have a Output-Input to-many relationship in my model. There are potentially an unlimited number of links under this relationship for each entity. What is the best way to identify a specific input or output? The only way I have achieved thi...

Drag and drop without implementing tableView:objectValueForTableColumn:row: and numberOfRowsInTableView:

I have an NSTableView with a single column, which gets its data through an NSArrayController bound to a Core Data entity. The data feed works great, and I have been able to get drag and drop working by implementing the methods – numberOfRowsInTableView: – tableView:objectValueForTableColumn:row: as well as the specific drag and drop me...

Debug/Run in Xcode stopped working. Executable settings are wrong and can't be fixed too.

I've just had a strange problem show up with my XCode project. The project is one that I've been working on for 4+ years. Just today, when try to start debugging, the debugging view opens and the console says "[Session started at 2010-10-03 14:04:35 -0600.]" but nothing else happens. It seems that the executable is screwed up. If I o...

Cocoa __ variable names

Hey guys, I had a question about naming conventions. I noticed in alot of cocoa classes people have made, and in apples core they name some of there variables like __name is there a reason for having the __ is this something I should be doing in my own classes? If so where and when should I use it? ...

Should I dealloc @property items?

The basic rule that I have been going by is "if I alloc, I dealloc," but is this an overly simple view? ...