cocoa

CoreAnimation doesn't work with -setAlphaValue on QTMovieView

Hello I have some basic code for adding a QTMovieView. I want it to fade in, so I add an animation on setAlphaValue. Only issue is that it doesn't work. The alpha value is instantly set to whatever it was supposed to animate to. If I try animating e.g. setFrame: it works fine. You'll find my code below. This is on 10.5.7 with the Mac OS...

NSSThread identifier

Hi, is there anything like an identifier of a NSSThread? The following code: NSLog(@"thread: %@",(NSThread*)aThread); results in something like this: Thread: {name = (null), num = 6} Is there a way to get this thread number, maybe? Best, heinrich ...

Applescript property setter not working correctly -- howto?

I have a <property> in my Cocoa project's sdef file, and I can get my Applescripts to read the property correctly, but I can't get them to set it (I get an error in the Applescript Editor). My sdef is pasted below. Is there a special convention for the property? I would have thought it'd just be - (void) setLength:(NSNumber *)len;. Is i...

BitBlt() equivalent in Objective-C/Cocoa

I made a scrolling tile 2D video game in visual basic a few years back. I am translating it to Cocoa for the Mac. Is there a framework that would allow me to use BitBlt? Or is there an equivalent to BitBlt without using OpenGL? Thanks! ...

How do I embed a web browser into my Cocoa application?

I need to learn how to add a web browser into a cocoa application. (Mac) ...

Refresh Cocoa-Binding - NSArrayController - ComboBox

Hello in my application I made a very simple binding. I have a NSMutableArray bound to a NSArrayController. The controller itself is bound to a ComboBox and it shows all the content of the NSMutableArray. Works fine. The problem is : The content of the Array will change. If the user makes some adjustments to the app I delete all the it...

Best way to implement Enums with Core Data

What is the best way to bind Core Data entities to enum values so that I am able to assign a type property to the entity? In other words, I have an entity called Item with an itemType property that I want to be bound to an enum, what is the best way of going about this. ...

On-screen keyboard for touchscreen app

I am developing a kiosk-style application that is going to be used with a touchscreen. Are there any simple, well-written on-screen keyboards for Cocoa? Note that this is not for an iPhone app, but rather targetting OS X 10.5/10.6. Thanks. ...

Getting first and last days of current week

How can I get first and last days of the current week? What I need is some way of filtering a set of objects with NSDate property to leave only ones, that appear on current week, and then filter them by days. Also I need some way to get localized day names. I've tried to play with NSCalendar, NSDate and NSDateComponents, but it seems th...

CoreData: Find minimum of calculated property

Say I have a CoreData entity "Point" with two properties x and y (both NSNumber). How would a NSPredicate need to look like to let me find the closest Point to say a,b? for distance = sqrt((x-a)(x-a)+(y-b)(y-b)) While I could define a transient property that calculates a distance to a predefined point I can't see how I could programma...

How to make NSColorPanel (using NSColorWell) and NSFontPanel's color panel co-exist?

I have a preferences panel in my application in which I have a NSColorWell for setting some background color and a button which opens an NSFontPanel for choosing a font. The behavior I want to have is the following: When I click on the NSColorWell then drag over some color in the panel, I want it to change the background color in my "...

Parameters from observeValueForKeyPath:ofObject:change:context:

I was wondering what the parameters from this method would return. - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context; In the documentation it says keyPath The key path, relative to ob...

Retrieving the information in the `change` dictionary from KVO.

The method - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { } has a parameter change which is a dictionary that contains information about the nature of the value change, how would I find out what was in this dictionary? ...

How do you find how much disk space is left in Cocoa?

I suppose I'd like to be able to find out for any storage, not just the system disk, but that's most important. ...

Stopping a loop.

As explained in my earlier question … This code … - (void)syncKVO:(id)sender { NSManagedObjectContext *moc = [self managedObjectContext]; [syncButton setTitle:@"Syncing..."]; NSString *dateText = (@"Last Sync : %d", [NSDate date]); [syncDate setStringValue:dateText]; NSEntityDescription *entityDescription = [NSEntit...

Starting programming Mac OS X

I'm starting a Mac OS X app that will connect to a small website I'm currently developing. The idea is that the app will store a number of snippets on a local database and then sync with the website whenever it can. So my questions are: Carbon or Cocoa? SQLite for local storage / another solution? Is there any decent free text-edito...

Parse Query String into a Structured NSDictionary

I have a query string: a=1&b=2&c[1]=3&c[2]=4 etc… I want a NSDictionary where a => 1, b => 2, c => [3,4]. Notice that that the value for c is an array. It should also be able to handle something like c[1][2]=5 to make an array of arrays c => [[5]]. Of course I can do it myself by splitting on the & and =, but what about other cases s...

Odd behaviour of an NSArrayController

I have a Core Data project with an NSTableView bound to an NSArrayController. I have two buttons, one adding an object to the table and one removing the object from the table. The Add method uses a custom method which directly creates a new Core Data object. The remove method uses the standard Remove method of an NSArrayController. My ...

Cocoa Application Framework with Packages

Ok, I am creating a document-based application in Cocoa and the document's file type is actually a package. Within that package is an XML settings file, a SQLite database and a zip file which is downloaded at runtime. Now the only thing that changes, really, is the XML settings file as the other ones can be recreated at run-time. Each...

Calculating number of seconds between two points in time, in Cocoa, even when system clock has changed mid-way.

I'm writing a Cocoa OS X (Leopard 10.5+) end-user program that's using timestamps to calculate statistics for how long something is being displayed on the screen. Time is calculated periodically while the program runs using a repeating NSTimer. [NSDate date] is used to capture timestamps, Start and Finish. Calculating the difference b...