Tag: cocoa

Simple progress bar is not updating

I am implementing a Cocoa Application which is just a simple progress bar that starts when I press a button. The situation is: I can see Animation is Start and Stop when I press the button, but the progress bar will not update the value. I had also tried the solution mentioned here but it […]

Core Animation window flip effect

Any tutorials or sample code to get the Core Animation window flip effect? I’m using Flipr right now, which uses Core Image to generate the effect but CoreAnimation is much smoother Thanks

Use specific localization in Cocoa app

How can you make your cocoa app use a specific locale / localization thats different from what the current locale says? My app has a number of localizations and I would like to be able to choose the localization the app uses in a config file. How can I tell Cocoa which of the localizations […]

Getting NSMenuItem of NSMenu tree by title

I have an NSMenu (let’s say the Main Menu), with lots of NSMenus in it, and NSMenuItems at different levels. I want to be able to get the NSMenuItem instance specifying the tree path (with the title of the corresponding NSMenus/NSMenuItems in it). Example : Menu : File New Open Document Project Save Save As… […]

CGEventPostToPSN() not working for mouse clicking

I need to send mouse click events to an arbitrary process (not necessarily the front one) without bringing that process’s window to the front. This code works for sending a mouse click and letting the window server send it to whatever process it decides has focus: #include <ApplicationServices/ApplicationServices.h> int main() { CGEventRef down, up; down […]

How to launch New Message window in Mail.app from my application

I am able to launch Mail.app using the command [[NSWorkspace sharedWorkspace] launchApplication:@”Mail.app”]; but I want to launch the new message window in Mail.app instead of whole Mail.app. How can I do so?

Communication between Main Application and loadable bundle

OK, it’s rather self-explanatory. Let’s say we’ve got our cocoa application. Let’s all assume that you’ve already got some “plugins”, packaged as independent loadable bundles. This is how bundles are currently being loaded (given that the plugin’s “principal class” is actually an NSWindowController subclass : // Load the bundle NSString* bundlePath = [[NSBundle mainBundle] pathForResource:@”BundlePlugin” […]

Add a close button to NSTabviewitem

I have a application with a tab view when the user clicks in the menu for example “client data” I generate a tab programmaticaly. Now I want to subclass the tab view to add a close button for each NSTabviewitem. If you don’t have an answer you could help with documentation or sample code

How to handle NSTableView Drag and Drop for multiple rows

I’m fairly new to Cocoa dev, but implementing single row drag and drop within my NSTableView was fairly straightforward. However I’m now having a hard time getting it to work right when multiple rows are selected. It seems to work without fault when all the selected rows are sequential, but it fails when, for example, […]

Adjust Mac display brightness Objective-C?

Is there a way to adjust the Mac’s display brightness in Objective-C? I have sensitive eyes, and sometimes the display seems like it could be darker. Combine that with Jeff’s blog post about geeks and darkness, and it can get pretty annoying. I think it would stand to reason that if the display could be […]