How to completly restore a Edit menu in Cocoa or find missing Actions like Redo - cocoa

I deleted the Edit menu from my cocoa app but now I need to restore it with all the voices. I tryed to copy it from another app but it lose all the Actions... so I found myself with all the voices of the menu but they do nothing... so I started to connect all the voices in First Responder and it was working but then I noticed that some voices like "Redo" and others are not in First Responder and I don't know where to find them..
Is there a way to completly restore the Edit menu in my app? or if it is no possible anyone knows where I can find the missing Actions like Redo?
Thanks for any help - Peace - Massy

Look in the Interface Builder Object Library (Where there are buttons and other controls to drag onto your interface.)
There you will find Edit Menu Item. (Search for it if you can't see it.) You can drag it into your menu.

Related

Add your own NSMenuItem to Finder menu

I'm pretty sure this is possible since Dropbox has done it. Here's a screenshot:
http://content.screencast.com/users/calebjj/folders/Jing/media/eec88ca2-f9a9-4aa3-bd79-a78900087968/00000064.png
I'm looking to add an nsmenuitem to the finder menu when a user right clicks on a file in the finder window. Is this possible? If so how can this be done? And for that matter, so has TextWrangler (shown at the bottom)
What you are looking at is a service. Look up "Services Menu" in the Apple help and you'll find out how your application can offer these services.

Detect click on OS X menu bar?

I'm curious if there's a trick to detecting a click on the Menu Bar as a whole. I know I can detect a click on an NSStatusItem or NSMenu, but I am looking for events pertaining to the empty space of the Menu Bar.
Looking through the documentation, it does not seem possible. However, I wanted to know if anyone had a workaround for this functionality?
You can install a local event monitor using NSEvent addLocalMonitorForEventsMatchingMask:handler:
See the documentation located here.

How do I allow ⌘V into NSTextField without having a Menu?

I've removed the menu from my cocoa app, all of the interaction should happen from within a status item, that links to a menu, that links to different NSPanels. But this seems to have removed the ability to ⌘C or ⌘V within a NSTextField. Is there a way to add this back without having to have a standard menu included with my app?
Even if your app is a faceless background app, so it never shows a menu bar, you should still have a full main menu because that's what provides all of the default actions (and enables the user to redefine the key commands if they so choose). If you remove the main menu, you have to reimplement everything in it, including anything Apple adds in the future, in code.
And I'd especially warn you against trying to handle keyboard shortcuts yourself. That's damned tricky. A lot of applications get it wrong, causing us Dvorak users (among others) to curse their developers.
I assume you can just implement the actions originally connected to the menu items in a keyDown event. Check out this page for details: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html
Just have it respond to cmd-v with paste:, and cmd-C with copy:
Edit: Though I have to agree with Peter, you really should have a main menu...

Add custom menu items to the Finder context menu

How do I add custom menu items to the context menu for files in Finder?
Unfortunately, most of the information out on the Internet and on Stack Overflow doesn't work in 10.6 or are too limited. Automator, for example, doesn't allow you to create items dynamically or create submenus.
I know it's still possible to do this sort of thing because Dropbox and FolderGlance both do similar things. Does anyone know how they implemented this?
Thanks.
For what it's worth, Dropbox now uses mach_star for code injection. Obviously this is a fragile solution. If you look through their version history, many of their updates are to fix finder integration.
In macOS 10.10+, Finder Sync Extensions can be used to add items to the Finder context menu. This is how modern versions of Dropbox and similar apps customize the right-click menu.
For those just seeking to use the functionality, not develop their own app extension, I've released a Mac app that allows for arbitrary customization of a Finder Sync Extension:
Service Station - Mac App Store
I downloaded FolderGlance and it appears to use an osax (Scripting Addition) bundle to inject code into the Finder process. This is definitely fragile and unsupported.
As far as I am aware the only legit way to add items to the Finder contextual menu is to create a Service, but that doesn't solve your problem.
Up to to the OS X 10.9.x only injecting code to Finder process via mach_inject was a solution (and even Dropbox did that).
However since 10.10 there are Finder plugins, which can customize context menus, add buttons to Toolbar and put overlays over file icons.
They used CFPlugIn to add their menu items.
More on it here:
http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFPlugInRef/Reference/reference.html

Win32 newbie: Firefox-like find bar

Firefox has this nice find-a-text-on-the-page dialog, which is non-modal and shows up at the bottom of the window. How to do something similar using just Win32? I guess there has to edit control but do I have to position it manually on parent window WM_SIZE? How do I dismiss the dialog, i.e. how to make it disappear?
As said above, use a rebar and put an edit control and the buttons that you need on it. You'll have to manage all the rest yourself, manually (close button, showing/hiding it, etc.).
I guess that is what you call a rebar...http://msdn.microsoft.com/en-us/library/bb774373(VS.85).aspx. Google if you need more info...

Resources