![]() 3D 3D Photo Gallery (Part 1) 3D Photo Gallery (Part 2) Audio Poor Man's MIDI Make A Metronome iPod Tricks (Part 1) iPod Tricks (Part 2) iPod Tricks (Part 3) Laugh Track Machine Audio Player with Reverb Shepard Melody RB Phone Home Build a Drum Machine Custom Controls and Windows Double Click Listbox Draggable Metal Window Double Click Canvas Custom Buttons Custom Buttons Part II iTunes-style Listboxes Custom Controls General RB Scrolling Windows Using Mesage Dialogs Case-Sensitive Word Finder Introduction to Stacks Wiggle Window JPEG in PDF Listbox Checkboxes Background Applications Listbox Auto-Find Virtual Volumes Time Tracker Software Distribution (Part 1) Software Distribution (Part 2) Software Distribution (Part 3) Software Distribution (Part 4) Exceptions Tips and Tricks Text Clippings Made Easy Graphics Drawing a Simple Gradient The SpriteSurface: Space Game Image Spinner Cropping Graphics (Part 1) Cropping Graphics (Part 2) Cropping Graphics (Part 3) Cropping Graphics (Part 4) Shimmer Graphics Lissajous Figures Simple Screen Capture Vector Graphics Kaleidoscope Images Stegonography Spirals! Image Table RB Magnifying Lens Screen Capture Color Picker Tutorial Hacks Ghost Grab Speedy Mouse Extension iTunes Plugins iTunes Skinner Mac OS X Global Hot Key Event (Carbon Events) Login Welcomer (Carbon Events) Add/Remove Buttons Resizable Sheets Mac OS X Preferences Window Using Sheets in REALbasic Build a Bundle (Part 1) Build a Bundle (Part 2) Dock Your Passwords Mac OS X Debugging REALbasic Mac OS X Icon Tutorial Animate Your Dock RB and the Command Line Menus Window Menu Templates Menu Listbox Menu Novelty Guessing Game Calendar Trivia Tile Mixer Zip Code Finder Happy Valentine's Day Merlin Simulator (Part 1) Merlin Simulator (Part 2) Merlin Simulator (Part 3) Buzzword Machine AppleSoft BASIC Printing Print to PDF Registration Registration Code Validation Network Registration Codes Resources Picture Extractor (Part 1) Picture Extractor (Part 2) Serial Caller ID (Part 1) Caller ID (Part 2) Caller ID (Part 3) Speech Speech Recognition Socket Communication Easy Peer-to-Peer File Sharing MacPAD Version Checking Display Web Image In Canvas HTML IMG Tags Version Tracking Even Smarter Instant Messaging Web Tiler JavaScript and REALbasic Stock Ticker (Part I) Stock Ticker (Part 2) AIM Mate XML Manipulation Simple XML Introduction Video Big Brother Video Capture Note: All articles without a byline were written by Erick Tejkowski. When cleaning the site I removed them because the code differed from page to page, and I have yet to put them back in.
Tell us about a bad link. |
Of all the great technologies available to Mac users, perhaps the most overlooked is that of the Clipping file. Clipping files permit you to store data in a file that can be viewed from the Finder. Furthermore, they are especially nifty, thanks to drag-and-drop. Text clippings are handy for quick storage of text data such as:
Of course, clippings can hold other kinds of data, but for now we will limit the discussion to text. Creating Text Clippings To create a text clipping, open your favorite text editor (even Simple Text will work here). Type a few letters, select the text, and drag that text to the desktop. The text becomes its own miniature file. Double click the clipping file in the Finder and it opens to reveal the text in a Finder window. While the text clipping is open, you may also copy the text to the clipboard. Resource Information Text clippings usually consist of two or three resources. The important one here, though, is the 'TEXT' resource. As you probably guessed, this is where the text of the clipping resides. So, what on Earth does this have to do with REALbasic? Armed with REALbasic and your knowledge of text clippings, you can create a miniature "database". REALbasic makes it easy to work with resources. Text clippings are already very versatile, but sometimes it is a nuisance to constantly open the clipping to view its contents. This example shows you how to keep tabs on your text clippings and make them even more useful than ever. Build the Interface To create the interface for this project, fire up REALbasic and open the Window1 Window Editor. From the toolbar drag the following into the window:
Add the Code To make the interface do something, double click Window1 to open its Code Editor. In the Open Event of the window, add this code: dim n,i as integer This code first looks for a folder named "Clippings" in the same directory as your application. If you haven't yet, create this folder now. This folder will be your storage place for text clippings. Next, the code loops through the items in the "Clippings" folder, looking for clipping files. When it encounters one, the file's name is added to the Listbox. Next, open the Code Editor to the Change Event of the Listbox and add this code: This code will fire each time a row is selected in the Listbox. When a row is selected, the code creates a FolderItem representing the particular Clipping file. This FolderItem's resource fork is then opened and the 'TEXT' resource is retrieved (resource # 256) and displayed in the Editfield. The code concludes by closing the resource fork. Finally, add code to the PushButton's Action Event : This code copies the text from the EditField to the Clipboard. Of course, you can also select the text manually and copy it using the traditional Edit->Copy menu. You gain this functionality for free with the EditField. Test and Build The last step is to test and build the project. Test it by selecting Debug->Run. When you are sure that everything works as expteced, select File->Build Application. Once you have finished building your application, add a bunch of text clippings to your "Clippings" folder and you gain instant access to the contents of each. The project is also compatible with Mac OS X, so you can create an Aqua version as well. If you are having troubles getting the code to work, you can |
|||||
|
Please support ResExcellence by Visiting our Sponsors. One click makes a difference. |
||||||
|
|