cocoa

NSTextField in NSMenuItem

Hi am writing small app for posting twitts on twitter.com I manage to create statusbar icon next to clock and battery monitor, but now I am stacked... I wanted to add menu item text area max length of 140 chars, (4-5 rows text input field) something like spotlight but multi-rows (BTW I have got working class, to put and get twitts on t...

NSDatePicker - getting the value when it is changed

How would I get notified of a value of a NSDatePicker, when it's changed? ...

Making headers public in Xcode Framework

Is there a fast way to make headers public when setting up a Framework in Xcode? I always have to click through one by one, changing each one from private to public. This irks me. Thanks. ...

Obj-C server with multiple clients

Hi, I'm a fairly novice obj-c developer and have a question on how to set up a client-server relationship. I'm designing (mostly as a hobby) a board game to be played over the internet with friends and family (think monopoly). My problem: how do I set up the appropriate client-server relationship to have one server with multiple clien...

Why can't code inside unit tests find bundle resources?

Some code I am unit testing needs to load a resource file. It contains the following line: NSString *path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"txt"]; In the app it runs just fine, but when run by the unit testing framework pathForResource: returns nil, meaning it could not locate foo.txt. I've made sure that foo.t...

Unable to Set/Get Volume of Input device which has single channel than Master

Hi, I am trying to Set/Get Volume level of Input device which has only single channel but no master channel, then it fails to retrieve the kAudioDevicePropertyPreferredChannelsForStereo and intermittently kAudioDevicePropertyVolumeScalar for each channel. But this works well for Output device. So is there any difference in setting/gett...

How to prevent a Beep sound if global keyboard shortcut is pressed in the other application?

Mac OS X 10.6 — Cocoa I'm using global event monitor for displaying status item menu using custom keyboard shortcut: globalEventMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) { if ([event keyCode] == kVK_F12) { [self handleGlobalShortcut]; // How to prevent syste...

Residual/trace in Core Animation & CALayers

I am making an Cocoa app, using Core Animation to create custom UI. However, whenever I drag some layers around, they often leave some "residuals/traces" onto the other layers. So far, my guess is that it is related to my usage of [setNeedsDisplay]. To my understanding, as I drag a layer around, I don't need to call this method to that ...

Is self a pointer?

What kind of thing is self? Is it correct to call it a pointer? Or is it a variable? Or what else? ...

Metal Toolbar Icon Sizes

I am trying to create rectangular metal toolbar icons for a mac app like the ones seen in Safari, but can't seem to find any information on the pixel size. Human Interface Guidelines recommends that metal toolbar buttons should not exceed 19x19, but doesn't specify what the size of the icon should be if the user chooses "Use Small Size...

Get NSComboBox to work like an HTML Combo

Is it possible to have the values displayed in an NSComboBox be different from what is retrieved with objectValueOfSelectedItem? So, it will display an object's string name but it's int recordId is returned instead of the string name? Other than using selected index and getting it from the source array, of course... ...

Programatically instantiating a NSPopUPMenu without a NSPopUpButton with Cocoa OSX

So awhile back I made a cocoa widget that was a button that when pressed, would pop up a popup menu and handle the selection. This was quite trivial using the NSPopupMenuButton class but now I need to do something slightly different. I have an openGL widget and when I click on a certain part of this widget, I need to pop up the same po...

Can you specify "select unique name from ..." with NSPredicate?

I've got some data stored in Core Data that looks something like: | name | identifier | other_stuff | I need to display the names in a UITableView, but I only want to display the names with unique name-identifier pairs. So for: John | 3 | foo Betty | 4 | foo Betty | 4 | bar I only want the query to return John, Betty. Something li...

IBoutlet with PyObjC and Interface Builder

I'm writing a simple OSX app using Python and PyObjC. I designed the settings dialog using Interface Builder and I use ibtool to compile it, then load it from Python. The problem is how to access the controls I have in this window from the Python code? I played around with iPhone development a bit before and I remember I need to have an ...

Synchronous Distributed Objects Over NSConnection Issue

I have an application that pulls data from the web, parses them, and compiles the results in a search interface. Since the data are not co-dependant, it made sense to multi-thread the application to execute multiple fetches and parses simultaneously. I use NSInvocationOperation on a search and parse object I have written to execute thi...

How to write a C++ handling class for Objective C

// -------------------------------------------------------------------- UPDATE: I messed up. I left a call directly to openfeint in my AppDelegate->onApplicationWillResignActive which was causing the compiler C++ error. My Appologies, the singleton does work should anyone be thinking of trying the same thing. Just be sure to include t...

Handwired NSTextView clipping bug

I'm trying to assemble a NSTextView by hand as in Apple's TextSizingExample and found a boring bug. If you run TextSizingExample and select "Wrapping Scrolling Text" mode, then you'll see the text being partially hidden by a vertical scrollbar. Tried to play with the size and autoresizing mask of text container and text view but it didn'...

Modal View Shake Gesture

I am having an issue with using a shake gesture with modal view switching. The shake gesture works when I move into the specified view controller the first time. When I exit and return however, it does not. I have implemented the can become first responder and viewdidAppear techniques, and the console detects a shake using an NSLog en...

NSLog, NSError, bad access

I was doing a rather ordinary addPersistentStore to an NSPersistentStoreCoordinator, and it generated an &error code. So I went to NSLog it, and got an access error when I did this: NSLog(@"Unresolved error %@, %@", error, [error userInfo]); which seems to be the common idiom. When I reformatted the error statement as follows: ...

IOBluetoothHostContoller in 10.5

The following code compiles fine when compiling as Mac OSX 10.6 as the active SDK (linked with the 10.5 frameworks, 10.5 set as the base SDK) IOBluetoothHostController *controller = [IOBluetoothHostController defaultController]; However, if I compile it with Mac OSX 10.5 as the active SDK, I get an error message saying that IOBluetoot...