Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add find panel capabilities to some Cocoa apps System
In many Cocoa applications, the developer has decided to leave out the built in find capabilities of OS X. With applications that handle large amounts of text, this can be extremely inconvenient. Luckily, it is possible, with a little work, to modify many applications to support simple find operations.

Note:
This hint requires that you have Apple's Developer Tools installed. It also requires that you run 10.2 or higher, because 10.1 and below didn't have the "find" feature built in. It is generally good practice to modify a copy of an application, so that if you mess something up, you can get back to a working version. Interface Builder automatically keeps backup files (with a "~" at the end of their names), but it's still a good idea to make a backup copy first.

[robg adds: I have not tested this hint...]

Here is the procedure:
  1. Find the main nib file for the application you are editing. To do this, locate the application in the Finder, control-click its icon and select "Show Package Contents" from the contextual menu (if the the menu doesn't have the "Show Package Contents" option, then the application is most likely Carbon, and this hint won't work). Open the folder called "Contents." And in that folder, open the folder "Resources". Look for a file called "MainMenu.nib." The name may be slightly different, but it will be similar. If the file is not in this folder, open the folder called "English.lproj" or a similar folder with your preferred language. If you still can't find the file, then the app is probably Carbon.

  2. Open the "MainMenu.nib" file with Interface Builder. There should be a little menu icon in the "MainMenu.nib" window. Double click this icon.

  3. Check to see if the Find menu exists. If so, skip to step 5.

  4. Make sure you are showing all palettes (if not, hit command-/) and click the menu icon in the Cocoa palette. You should see a list of menu items in rectangles. Drag the item called "Find >" to the "Edit" menu. (traditionally it should be above "Spelling") Save the nib file.

  5. This is the tricky part. You need to find the text field(s) that you want to be findable. In document-based applications (for example Text Edit), you will need to search through the other nib files in "English.lproj" to find which one has the text field(s) you want to find in. If the application is not document-based, chances are the field is in the "MainMenu.nib". You can just double click the window icons in the nib files; they will look more or less like the interface from the application.

  6. After you find the text field you're looking for, select it. In the "NSTextView Info" palette, choose "Attributes" from the popup menu. There should be a check box that says "Uses Find Panel". Check this box, and save the nib file.
That's it! Now you should be able to use find in the modified application.

One last note:
Some applications won't work with this hint. One example is iChat, which is a shame, because it would benefit from find capabilities. You can usually tell if an application won't work if the text field is an "NSView" or something else other than "NSTextView."
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,710 views]  

Add find panel capabilities to some Cocoa apps | 3 comments | Create New Account
Click here to return to the 'Add find panel capabilities to some Cocoa apps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Re: Add find panel capabilities to some Cocoa apps
Authored by: LazLong on Dec 03, '03 12:28:39PM

Just so fellow readers out there know...this does not appear to work for Applescript Studio apps build via XTools and Interface Builder. (I don't get a selection concerning 'Use Find' in the Attributes panel.

Laz



[ Reply to This | # ]
Add find panel capabilities to some Cocoa apps
Authored by: danieleggert on Dec 07, '03 07:43:19AM

Please be aware, that most licenses make it illegal to modify application code as explained in this hint. Yes that's right, even if you are modifying .nib-files you are most likely breaking copyrights.

Even if the program is open-source this is most likely not allowed by the license. Just wanted to let you know.



[ Reply to This | # ]
Add find panel capabilities to some Cocoa apps
Authored by: mistercow on Dec 08, '03 08:04:25PM

Usually those licenses are referring to modifying the code to distribute it, not for your own personal use.

Even if the license specifically prohibits this simple modification, it would never hold up in court.

After all, if I take a photograph and put it on the internet with a license attached that says "You may not modify this photograph," I won't be able to sue someone who edits it for their own personal use.

Modifying software to get past it's copy protection is a different story, of course, but that's under somewhat different laws.

Lastly, if an application is open source, and it doesn't allow you to modify a nib file, then it isn't really open source at all is it? Open Source Initiative states in their definition of open source that "The license must allow modifications and derived works, and must allow them to be distributed under the same terms as the license of the original software."

In closing, if a developer sues you for adding find panel support to an application for your own personal use, you will probably get a lot of money when you counter sue for a frivolous lawsuit.



[ Reply to This | # ]