cocoa

NSOutlineView -- reloadItem:reloadChildren: crashing my application

Hi guys I am trying to reload a particular item in my outline view using reloadItem or reloaditem:reloadchildren function in NSoutlineView but its crashing my entire application. please can you tell me a workaround for this like I also tried to collapse that item and expand it again but it is not reloading that item and its children. R...

How do you change the state of the window close button in Cocoa?

In Cocoa Applications, you often see a little red dot in the window's close button when you have unsaved data; TextEdit is a good example of this. I've pored through the Cocoa documentation but I can't find a way to programmatically set this state. I'm sure there's some really easy way to do it, but obviously I'm missing something. ...

Providing data as needed for QTMovie

I understand that if I wanted to provide a QTMovie with data from an arbitrary source as it is needed I probably have to deal with the QTDataReference class, but unfortunately my experience with anything similar is limited to an audio data callback with Audio Buffers on the iPhone. If I initialized the QTDataReference with some NSMutabl...

Creating a checkbox programatically using Cocoa

I need to create a checkbox programatically in Cocoa and when I try and make a button with ButtonType set to NSSwitchButton it displays the title I gave it but not checkbox. I think I am missing something but I can't find any resources about making things like checkboxes without using the XCode GUI. Can anyone link a good resource plea...

Detect when removable storage is unmounted.

Hi Guys I am working on an app which should detect events that happen when removable storage is unmounted or forcefully unplugged from the USB. how should I get these events? I have seen NSWorkspace for the first possibility of smoothly unmounting the device but this class has methods like – unmountAndEjectDeviceAtPath: to unmount a de...

How to test whether application handles slow/flaky filesystems properly?

I want to ensure that my application doesn't have any UI freezes when working on files on slow filesystem (e.g. networked, CD/DVD or spun-down HDD). I'm using Cocoa filesystem operations directly. I'm afraid it would be too much effort to mock or abstract all of it just for testing, and besides there could be non-obvious ways in which m...

NSMenuItem enabled state, dynamic naming and target action.

Hi Guys I am having a problem with my app's menu. I want a few items in the menu to be greyed out depending on some BOOL variables. Also, I want some of my menu items to get names depending on some BOOL variables and thereby execute different functions depending on what the menu item name is. Is this possible? As using Interface Build...

Can someone explain what a delegate is with an example?

i read a lot about objective c delegate but didn't get clear idea.Can anyone explain it with a good and precise example so that i can understand it. Advanced thanks for your reply. ...

Blending modes on CALayers on screen? Is that possible?

Is that possible to have a CALayer over another one composed using a blending mode on screen? I now that it is possible to do that offscreen using drawinrect, but is it possible to see it live on the screen? thanks for any help. ...

How to change style for nodes in NSOutlineView?

I am trying to figure out how to change the style for group nodes in NSOutlineView. With setSelectionHighlightStyle I can change the whole list style. But I want to change only the style for group nodes. How can I do that? ...

[CIImage drawAtPoint:…] vs [CIContext drawImage:…]

What is the difference between the last two lines? CIImage *outputImage = [compositingFilter valueForKey:@"outputImage"]; [[[NSGraphicsContext currentContext] CIContext] drawImage:outputImage atPoint:point fromRect:fromRect]; [outputImage drawAtPoint:point fromRect:fromRect operation:op fraction:delta]; The last one produces a d...

Log file rollover when logging to file using Google toolbox for Mac

I'm using Google toolbox for Mac's GTMLogger to do logging to file in the app I'm working on. I'm trying to decide how to do log file rollover when the file gets large enough. Ideally I would like something like log4net's immediate rollover when the log file hits 1 mb with max 11 log files at any one time, but I don't see any built-in ...

Globally hide mouse cursor in Cocoa/Carbon?

Is there a way to globally hide the mouse cursor for all apps in Cocoa (or Carbon)? Or at least replace it with something else? EDIT: Thanks for the input guys, but turns out Daniel Jalkut found the solution a while ago :) http://lists.apple.com/archives/carbon-dev/2006/Jan/msg00555.html ...

Tinting a grayscale NSImage (or CIImage)

I have a grayscale image which I want to use for drawing Cocoa controls. The image has various levels of gray. Where it is darkest, I want it to draw a specified tint color darkest. I want it to be transparent where the source image is white. Basically, I want to reproduce the behavior of tintColor seen in UINavigationBar on the iPhone....

pboard types will be deprecated

According to NSPasteboard.h (line 294 in the standard Snow Leopard copy of the Xcode SDK) it states: /* Use of pboard types should be replaced with use of UTIs. Pboard types will be deprecated in a future release. */ I've tried finding samples of using UTIs as a replacement for pboard types but I can't find anything anywhere that demo...

Cocoa Textured Window in QT

I am using Qt to develop a cross platform application. I am trying to replicate the look and feel of the left two windows (A HUD window and a textured window) but so far I can't see how to get any kind of window except for the right most window. Does anybody have any idea how to replicate those type windows? ...

How can I split a string without separator?

I need to split string without a separator. Here is the code.. myarray = [mystring componentsSeparatedByString:@","]; Here I used separator "," to split string, but I want to split without using a separator NSString *mystring =@"123456"; I have this value , now I want to insert that value in an array like this: array[0]=1; array[...

NSPredicateEditor and relationships

I've seen that every predicate that works in a query with a relationship contains at the start the words ANY or ALL (ie: ANY tags.name LIKE[c] "car"), the fact is, if I remove it (ie: tags.name LIKE[c] "car"), the result is wrong or I get a message like this one : Can't do regex matching on object. Since i'm using an NSPredicateEditor t...

Using NSFontPanel in Cocoa

I'm trying to use an NSFontPanel to allow the user to change an application-wide font setting. It's supposed to work something like this: the user clicks a button, a font panel pops up, they choose a font and a size, and their selection is persisted. The following code shows the panel: - (IBAction)showFontMenu:(id)sender { NSFontMa...

NSTableView Troubles

Hey everyone, I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck with getting the NSTableView object to work for me. I've followed all the directions, but for some reason I still get this error: Class 'RobotManager' does not implement the 'NSTableViewDataSource' protocol Here's my source, tell me what...