cocoa

Updating a NSTableView data source from a background thread.

What is the best way to synchronize a data source which is updated frequently from a background thread with the GUI main thread? Should i put a pthread mutex around each method call? This seems to be pretty heavy too me. EDIT: I'm looking for a 10.5 solution ...

NSMetadataQuery and NSDate: precision problem

Hi, I was using NSMetadataQuery to find files which creation date is more recent than a NSDate. It seems that NSMetadataQuery cannot find files which creation date is more recent than the specified NSDate for one hour. I mean if the creation date of a file is today at 12:10:50, the query return no result if I set today 11:10:49 as NSDate...

How to set a NSView hidden with FadeOut animation in cocoa?

I'm hiding a subview from a CustomView element with the following code: [[[theViewcont subviews] objectAtIndex:0] setHidden:TRUE] how can i add a fade animation on hiding this NSVIEW? ...

How to make the dock reload all dock tile plugins?

I am making an application which uses a dock tile plug-in. However, when I recompile my dock tile plugin, the dock still uses the old one, even when I killall the dock. The only way to fix this is by rebooting my Mac, but I don't want to reboot it for every little code change I make. Also, dock tile plugins are poorly documented. Can any...

XML-RPC Server in Cocoa

I need to create an XML-RPC server on the iphone for testing purposes. Is there is a library I could leverage? ...

Combining objects in an array

I have one array that is pre-filled with dictionaries with each dictionary consisting of two keys. { name = object1; quantity = 5; }, { name = object2; quantity = 2; } I want to be able to add more objects and combine any duplicate dictionaries. So for example, if I added 5 of object one and 3 of object 2, this would be t...

NSTextView hangs while typing

Hi, I'm experiencing hangs while typing on an NSTextView. The NSTextView is on a window that I run modally. [NSApp runModalForWindow:[self window]]; I'm not really sure how, but I think it has something to do with the scrollbars. When I click the "enter key" until it starts scrolling down, it always hangs. Can you please help me how ...

exception thrown trying to insert new table row into section

I seem to be encountering a very odd problem which only occurs when trying to insert a new NSManagedObject into a new section. Basically my sections are days and individual cells are associated with times. When I MOVE an object to a day which doesn't currently have another object (table row) associated with the day, the table needs to cr...

Reimplementing the Mac OS X Dock's auto hide

I'm trying to make a server monitor in Objective-C, that behaves kind of like the dock on Mac OS X. I'm hoping to have it slide from the side of the screen when the mouse is moved to a side of the screen, kind of like a dock with auto hide on. I'm not sure where to start though. I'm guessing I need to have a window with a NSBorderlessWi...

Creating a list of entity parents using a core data fetch request/predicate.

I have a core data model, using the database store, that contains entities with classic parent/child relationships. Each parent has a number of children, each child a single parent, creating a multi-level hierarchy. What I would like to do is use a predicate in a fetch request to return a list of all the entities between a given entity...

Return junk value for selectedRow in NSTableView

Hi All, I have a code which returns selected row for NStableView as under: int status; NSUInteger selectedRow = [tableView selectedRow]; if (selectedRow == 0) return; But, when i have not selected any row in table view or if the tableview is empty, it returns junk value. How can i tackle with this problem. ...

Can i create my own memory management to handle Cocoa Objects

In C and C++ i use the popular memory pool allocator. Where a huge chunk of memory is allocated and then all small objects are allocated inside it. When done everything is freed with a single call. I was able to speed up some bottlenecks my app by factor 10. Question is how can i do this with Cocoa? How can i overwrite the alloc method...

setActionName: method purpose for NSUndoManager class

Hi All, setActionName: method description says that it set the action name for undo or redo command. But, my doubt is how the undomanager use the action name set by the above method. Regards, iSight ...

Help with iPhone sample code

I'm trying to build this iPhone sample: http://trac.pjsip.org/repos/wiki/Getting-Started/iPhone but I'm having trouble since I am new to both iPhone development and the Mac world. From the Build Preparation section, I've downloaded the source code, but step 2 here is to "set [my] config_site.h" to a particular value. Do I just double...

GtkFileChooserDialog in Cocoa

Hi, I justa want to know if there's a class like GtkFileChooserDialog in Cocoa. This class is used in gtk for opening a file. ...

How to comment Apple's block extension for Doxygen 1.7.2?

Doxygen annouced in their changelog for version 1.7.2 to support Apple's block extension. I wonder what the syntax is to generate the documentation. I could not find any hint - also not in the Doxygen configuration file (version 1.7.2). ...

Simulate key press events for ioquake3 in Mac OSX

Hi, I am currently writing an application which simulates key press events in Mac OSX to control ioquake3. My current approach is to create the key press events with the Quartz Event Services. This works fine with e.g. TextEdit but not with ioquake3. CGKeyCode keyCode = 126; // 126 is the "up" key CGEventRef event1 = CGEventCreateKeybo...

How do I draw a background like the nstoolbar

I am trying to make a custom toolbar to use anywhere. I want the background to look like the gray that the nstoolbar has. The color is used in several places like the top of Safari or Mail. Does anyone know of an easy way to draw it? Or use the nstoolbar somewhere other than the top of a window? ...

Creating a label using NSTextField is blurry

Hi, I'm trying to create a label programmatically using NSTextField, but it comes out blurry: screenshot This is my code so far: NSTextfield *textfield = [[NSTextField alloc] initWithFrame:NSMakeRect(5,5,150,20)]; [texField setStringValue:@"some text here"]; [textField setEditable:NO]; [textField setSelectable:NO]; [textField setBorde...

@property problem - Objective C

Hello, I'm having a problem with properties. First, I define it: @property (readwrite) BOOL isPerformingOperation; then synthesize it: @synthesize isPerformingOperation; Then I am setting the property as such: self.isPerformingOperation = YES; To make sure I've done things right, I log: NSLog(@"class perform is %i",self.isPerfo...