cocoa

Hightlight color for NSDatepickerCell

I am trying to do a little timer app in Objective-C/Cocoa. I am using the NSDatePicker to be able to set the start value. I managed to change the text color to green, because the whole app will be in green on a HUD panel: But there is a problem. Whenever I am using the picker to change the value, it highlights it wit a gray color and ...

Getting started with cocoa drawing

I want to do some custom drawing in a NSView subclass where should I get started? ...

Placeholder objects in Interface Builder

Could someone explain the kinds of placeholder objects that may appear in the Interface Builder document window? The kinds of placeholders that I know exist are: File's owner, First Responder and App Delegate Links: This thread explains First Responder. This thread explains the App Delegate. iPhone Interface Builder and Delegates: An...

Catching keyboard events in a Cocoa app WebView

I have a Cocoa app that embeds a WebView. I'd like to intercept a keyboard shortcut so that I may perform an action in the WebView. I do not want to implement a menu item for this action. In fact, ideally I only want this shortcut to apply when the user is in a textarea box in the WebView. How do I catch the keyboard shortcut so that I...

Customizing NSTableVIew

How could I change the background of each row of a NSTableView? ...

Local object scope and memory management in Cocoa

I'm new to Objective-C and Cocoa programming, so in my first sample projects I've always adopted the statement of releasing/autoreleasing all my allocated and copied objects. But what about local objects allocated inside methods? Let me write some sample code, here is my object interface: @interface MySampleObject : NSObject { NSMe...

What are the arrow brackets "<…>" in an Obj-C class interface for?

Can anyone tell me what the arrow brackets "<…>" in an Obj-C class interface do? Like this… http://snipt.net/robhawkes/cocoa-class-interface @interface MapMeViewController : UIViewController <CLLocationManagerDelegate, MKReverseGeocoderDelegate, MKMapViewDelegate, UIAlertViewDelegate> { I've previous programming experience with web la...

How to intercept a hot key in Cocoa when the application window is not active

I am trying to create a utility that doesn't open a window when executed, and that would be activated from a hot key; I read that currently Cocoa doesn't have a function for that, and that I should use a deprecated Carbon function. Isn't there really a way to use global hot keys in Cocoa? What should I do: wait for Cocoa to introduce a ...

Releasing With NSMutableArray?

I am allocating myMDD in main which contains an NSMutableArray instance variable (alloc/init-ed in init). When I add items to the NSMutableArray (frameList) I release after adding. The array and the objects it now contains are released at the bottom of main. int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSA...

Tools to create the file necessary to integrate an application with AppleScript

Are there any tools that allow to create the necessary files required to add the support for AppleScript in an application? I am looking for a tool that simplifies the task, possibility one that requires me to just give a description of the involved classes. ...

Calling methods from Xcode Debugger ?

Hello, what's the correct way to call a method from the Xcode debugger command line ? For example if I'm inside the sort: method of my class A (using the debugger), how can I call debugSort: method that belongs to class A too ? ( My code is Objective-C btw ) ...

Cocoa Xcode - how to pass a variable to a function

I'm trying to figure out how to pass a variable (in my case hostname) to a function i created from a programatically inserted "menu item". #function -(void)goToTerminal:(NSString *)hostname { NSString *s = [NSString stringWithFormat:@"tell application \"Terminal\" to do script \"ssh root@%@\"", hostname]; NSAppleScript *as = [[...

Making a Method be triggered when a row is selected in a Table View.

How would I trigger a Method when a row in a Table View is selected? ...

Finding out if a Window is Resizable

Is there a way to determine whether the active window (not of my process, but a different application) is resizable? Edit: I would prefer to do this without applescript as it then depends on the application being scriptable. ...

Programmatically controlling a Cocoa Button on OSX (making it invisible and pressed)

I am trying to interface with a cocoa popup menu from an OpenGL button. The actual button needs to be in OpenGL and I cannot stick an actual Cocoa button in its place but when this button is pressed I would like for a Cocoa menu to popup just like the one that comes up when you press the nspopupbutton. It seems that there is no way to ...

Why am I getting "does not support archiving" in my NSWindow subclass ?

Hi all - I have the following class: @interface SpWindow : NSWindow <NSCoding> { BOOL _editMode; SpBgView *bgView; } ... ... which I then call archive on. My encode method is as follows: - (void) encodeWithCoder:(NSCoder *)aCoder { NSLog(@"encodeWithCoder CALLED FOR SpWindow"); [super encodeWithCoder:aCoder]; NSLog(@"SpWind...

Snow Leopard Style Pop-Ups

Is there a framework that draws Snow Leopard style popups? For an example of what I am talking about, try right clicking something in the dock. I basically want to be able to give a starting point (where the arrow forms) and then a size and have it do the rest. In this case it's a menu, though my use would be more of just for drawing a ...

How to get image data from a WebView into an NSData object?

I have a Cocoa app that embeds a WebView. The WebView loads html elements including images. I have the textual links for the images (e.g. "http://www.domain.com/path/image.jpg"), but what I want is the image data itself so I can put it in an NSData object and ship it off to Growl. The WebView must have this data since it has downloaded a...

NSWindow does not respond to keystroke command-s

Hello, it may pre very simple, but cannot find it: I have three windows in three separate NIBs in my application. One is opened when a new document is opened, the other two can be opened from the program's window menu. The problem is: two windows (in them the one that is opened at the beginning) accepts the normal keystroke as for ex...

Confusion with popUpMenuPositioningItem:atLocation:inView:

The documentation for this method says: "Pops up the menu at the specified location." but the pamameters seem to describe a different situations: item The menu item to be positioned at the specified location in the view. location The location in the view coordinate system to display the menu item. view The view to display the menu it...