cocoa

EDMessage Example Code?

Hello Everyone! Can anyone help me make a EDMessage Sample Code? I don't know how to set up my headers and what the proper coding to input into my application. Here's the link if you need resources. BTW EDMessage is a framework used to send emails. EDMESSAGE. Here is the code I have so far for my headers: #import <Cocoa/Cocoa.h> @int...

How do I make an exact duplicate of a Core Data object graph?

I need to make a duplicate of an existing object graph from one NSManagedObjectContext and insert it into a second NSManagedObjectContext. Is there a straightforward way to do this? From what I can tell I could ask the MOC for its -registeredObjects and then do something like this to copy the attributes: NSString* entityName = [[...

How do I get the string length of the stringValue of an NSTextField?

This is probably a naive question but, how do I get the length of the stringValue of an NSTextField? I tried int len = strlen((char *)[textField stringValue]); where textField is an NSTextField but it always returns 6 (size of a pointer?). Besides I am sure that there is a more Objective-C way to do what I am after. ...

Qt equivalent to Win32 Fibers.

I am responsible for a Windows application that loads up plugin "script" dll's written in c++. The application exposes an API based on Win32 fibers to allow the c++ 'scripts' in the plugin dlls to use 'yield' and 'resume' type calls - essentially co-routines - to sequence the dependencies in the scripts without resorting to an asynchron...

CGBitmapContext get pixel value Leopard vs. SnowLeopard confusion

Im trying to draw specific colour rectangles into a CGBitmapContext and then later compare pixel values with the colour i drew (a kind of hit-testing). On Leopard this works fine but on SnowLeopard the pixel-values i get out are different to the colour values i draw in - i guess due to colorspace confusion and ignorance on my part. ...

Can't get NSAlert to continually bounce dock icon

I seem to have the exact opposite problem than this question on stopping dock bounce. I can't get my app to continually bounce the dock icon! I too hate continually bouncing dock icons, but in this case if the user doesn't realise my app can't launch, they could potentially lose hours of time tracking data. Here's my code that I've p...

How to receive data from the Wii Remote in Objective-C?

Hi all! I'm trying to write a Cocoa application which allows me to see what buttons I'm pressing on my Wii Remote. I also want to be able to receive Nunchuck-data and set the LEDs. Does anyone know where I can start? Oh, yes I did some searches, but I couldn't find anything useful. Thanks in advance. ...

Is there a programmatic way to refresh / reset a preview icon in Finder?

I noticed that while this applescript: tell application "Finder" {...} update itm with necessity {...} end tell refreshes normal Finder icons, on the other hand, it doesn't refresh the Preview icons under Leopard. I'm wondering if there's an AppleScript / Carbon / Cocoa / C way to refresh or reset a preview icon of a Finder file...

Converting RGB data into a bitmap in Objective-C++ Cocoa

I have a buffer of RGB unsigned char that I would like converted into a bitmap file, does anyone know how? My RGB float is of the following format R [(0,0)], G[(0,0)], B[(0,0)],R [(0,1)], G[(0,1)], B[(0,1)], R [(0,2)], G[(0,2)], B[(0,2)] ..... The values for each data unit ranges from 0 to 255. anyone has any ideas how I can go about ...

It's Possible To Develop Using Cocoa In Windows And Linux

Hello, I'm learning thinking in start to learn Objective-C and i don't have a Mac(And i don't have plans to have one), but as i see that Cocoa is a very good framework to develop in Objective-C, i want to know: It's Possible To Develop Using Cocoa In Windows And Linux? Thanks. ...

l2cap server/client using IOBluetooth (osx bluetooth stack)

I'm having trouble understanding the API to set up a l2cap (or RFCOMM) client/server running on OSX like I can with BlueZ on Linux. On Linux, I simply open a socket, bind, listen & then accept for the server, & socket, bind, connect for the client (w/ the bind taking in the BT address of the device I want to use). Also, there's no pair...

Verify the existence of a word in an NSString

I searched a bit, but couldn't find an answer to this (probably very simple) question. I have an NSString, and I'd like to check if it contains a word. Something like this: NSString *sentence = @"The quick brown fox"; NSString *word = @"quack"; if ([sentence containsWord:word]) { NSLog(@"Yes it does contain that word"); } Thanks. ...

Accessing an object created in another class in cocoa

How do I access an object that was created in another class. I have one class that constructs a web query goes online and pulls the data back. This results in an object that has all of the information I need. I want to be able to get the state of various variables in that object. The object probably won't change after creation ...

How can i tell if an object has a key value observer attached

if you tell an objective c object to removeObservers: for a key path and that key path has not been registered, it cracks the sads. like - 'Cannot remove an observer for the key path "theKeyPath" from because it is not registered as an observer.' is there a way to determine if an object has a registered observer, so i can do this if...

open and Multiple vs. Single Instances of a Cocoa App

I've got a script that opens my application using the "open" command. Right now, open is creating a new instance of my app each time it is called. What I would like to happen is that open would somehow detect that an instance of my app is already running, and then just send that instance the -(BOOL)application:(NSApplication *)theApp...

Binding a table column containing NSPopUpButtons

Hello all, I've got a table one column of which uses an NSPopUpButtonCell. Try as I might, I can't seem to figure out the way to properly bind everything the way I want it. Here's what I'm trying to do: I have an NSArrayController plucking items from a managed object context, called 'Field Values'. This is to be used to populate the po...

In Xcode Document App: Why would init method of MyDocument be called twice?

I followed Chapter 8 of Hillegass to implement the RaiseMan application there. Then I decided to follow the same process to implement the code for an exercise in a Cocoa programming class that I am taking, but I got the following very cryptic error message after building and running. Cannot create BOOL from object <_NSControllerObjectPr...

NSPredicate and simple Regular Expression problem

I'm having problems with simple NSPredicates and regular expressions: NSString *mystring = @"file://questions/123456789/desc-text-here"; NSString *regex = @"file://questions+"; NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; BOOL isMatch = [regextest evaluateWithObject:mystring]; In the above exa...

NSToolbarItem image scaling

Why is this happening: As you can see, in the "Allowed Toolbar Items" the image looks fine for the "PHP" toolbar item, and when its actually in the toolbar, it scales weirdly. Thanks ...

Proper design a Model-Controller in Cocoa?

Hi, I'm trying to design a simple Cocoa application and I would like to have a clear and easy to understand software architecture. Of course, I'm using a basic MVC design and my question concerns the Model layer. For my application, the Model represents data fetched on the Internet with a XML-RPC API. I'm planning to use Core Data to re...