Welcome to the REALbasic page of Thomas Tempelmann

Here you'll find some tips, examples, reusable classes and plugins for REALbasic. All code and information, unless specifically noted, is free for your unlimited use.


More articles

Go here more recent articles I wrote on REALbasic

Overview

Please note: Some of these plugins are rather old and do not support newer RB versions fully any more, e.g. no Carbon or Linux support. If you have a need for an updated plugin of these or other feature, please consult the Plugins mailing list (see here to subscribe) or contact Monkeybread Software who has taken over most of my older plugins.

However, those files that have been updated recently here, such as MacResource, the Zip package and RB Project Tool, are still supported by me.

Update Nov 2006: Most of these plugins are still in the old resource-based format which is not supported by RB 2006r4 any more. They need to be converted into the new RBX format. You can do this yourself by using the "Plugin Converter" which comes with the RB distribution and is found inside the Plugin SDK folder inside the Extras folder. But note that currently none of these plugins support Intel-based Mac OS builds (Mac X86). If you need that, try the MBS Plugins to see if they supply a replacement function, or ask their author to provide one.

 

REALbasic items created by me

More recent articles I wrote on REALbasic

Links to other RB related web sites

Links to my other pages



The Files

Splitter control (Mac, Windows, Linux)

A splitter control, based on code by Mars Saxman.

Download here (16 KB)

UndoEditField (Mac, Windows, Linux)

A lean EditField subclass with proper Undo behaviour

There are quite a few attempts at a "proper" EditField with Undo support (e.g. UndoFlattenEdit and Undo Toolkit)

They all attempt to deal with the various ways of how text can be altered in an EditField, trying to track deletions etc. by intercepting lots of Events. I am not happy with that, as it's never guaranteed that everything's covered.

So I came up with a much simpler solution, which is based on the original rule of how Undo has to behave in a text editor:

Download here (12 KB)

Diff

Finally, a diff algorithm in REALbasic!

It uses a Longest Common Substring (LCS) algorithm to find the differences in two arrays of Strings (or anything else).

Comes as a module containing the necessary classes, a self-test method and some demonstration code. Requires a recent RB version (e.g. 2007r5) because of the classes embedded in the module.

Updated Apr 4, 2011: Fixed a bug around case-sensitive comparisons.

Download here (25 KB)

RB Project Tools

A set of classes to read and write RB project files in their binary and xml formats.

Note: The "rbdocs.com"-Site had a lot of information relevant to this tool. Unfortunately, the site vanished a while ago. There is still some outdated information to be found in the internet archive, though.

Download the last version here (250 KB)

I have, since this release of 2007, turned this into a much more powerful tool, offering a full editor with source comparison, localization tools and many other features that make life easier for a REALbasic developer. This new version is not open source any more, though. More information on this here: Arbed.

Mac Resource file access (Mac, Windows, Linux)

This is a class, similar to RB's ResourceFork, that can read Mac Resource files. It works on all platforms and allows you also to read the new data-fork based resources on Mac OS X.

Tested to work with 2005r4 and RB 5.5.5 on Mac OS 9, Mac OS X and Windows 2000. Should work on Linux just as well. New version as of Dec 20, 2008: Finally works on Intel CPUs (odd that I didn't notice this before nor someone alerting me).

Download here (13 KB)

UTC (GMT) offset (Mac, Windows, Linux)

Contains just one function that returns the local time's difference in minutes to the UTC (Universal Time Coordinated) or to the GMT (greenwich mean time) without daylight savings.

Has been tested on Windows 2000, Mac OS 9 and X and various Linux systems. Also been verified to work with various time zones including non-full-hour zones such as in India (GMT+5:30) and summer times.

This sixth version (13 Feb 2008) is another bugfix for Linux suggested by Ed Lazor: Finds the "libc" now by a "soft" declare and checks for its availability.

Download here (5 KB)

Note: A totally different approach to a universal solution (may not work on Classic Mac OS, though) you can find here: REALbasic Gazette on GMT Offset

And finally, newer RB versions offer their own GMTOffset function in the Date class now. Probably this is the best option to use now.

Process Sleep Demo

This is a class (not a plugin) that uses Threads and Semaphores in order to allow a routine to put itself to sleep until some other code awakes the routine again so that it continues in its flow.

The whole thing is quite simple, really, but since it's apparent that most RB users do not know of this rather smart technique, I've made this demo for them.

Source code included, of course.

Download here (21 KB)

Windows EXE Version Fixer

This tool is helpful if you are still using RB 4.5 instead of RB 5. RB 4.5 (and earlier versions, too) do not automatically insert the correct version information into apps you build for Windows. This tool allows you to edit this version string in your built app afterwards, at least, so that you can manually add the version that RB failed to insert.

Note that this tool is probably only working with apps built with RB 4.5.x, but not with earlier versions, nor with apps built with other development systems.

Source code included.

Version 1.1 makes an important bugfix: The previous version had set the version information incompletely, leading to showing always "1.0" as the version on some Win versions.

Download here (815 KB)

Zip Package

The information has moved to its own page now:

Go to the ZipPackage page

XML Parser (Expat) Plugin (Mac OS PPC, Carbon, Windows)

I have taken Doug Holton's free Expat plugin, added Windows support, fixed a bug that would cause a crash when memory was low, improved access to Attributes, and enabled (local) entity resolving.

Don't ask for support, I don't have time for that. I just give it back to the community. It comes with a little demo project, though, and with Doug's original documentation.

The plugin's C Source code is included (for CW Pro 6), too.

Download here (285 KB)

Carbon versions (for Mac OS X)

Update (Jan 23, 2002): Monkeybread Software is now the official provider and caretaker of my plugins, with recent updates, carbon support and even some new plugins! And if you pay for them (it costs a little to use them), I even get a part of the money.

Older notes:

Looking for Carbon versions of my plugins? Doug Holton has converted some of them for free. Look for them here.

Plus, here's some carbonized plugins that others made and then sent back to me. Note, however, that I have not verified or merged them with my "official" versions. Use at your own risk and don't blame me until I've integrated them into my plugins listed further down.

RBplugin Plunger (Mac OS, PPC only)

(formerly known as RB Plugin Analyser )

Current Version: 1.2 (contributors: Björn Eiríksson, Alfred Van Hoek, T.T.)

Open any PPC-enabled RB Plugin with this tool to see what Controls, Classes and Methods it provides.

This code is Open Source, which means that you are invited to enhance the tool if you feel the need, and return the enhancements to me, so that I can make them available to everyone.

Download here (792 KB)

Note: There's also a far more improved version 2, now maintained by Alfred Van Hoek on his webpage.

Plugin Starter (Mac OS 68K/PPC/Carbon, Windows)

If you want to write your own plugins, you may use this skeleton. It requires CodeWarrior Pro 4 or higher. It supports 68K, PowerPC, Carbon and Windows x86 code generation.

Updates:

Download here (182 KB), complete with source code, documentation and sample code.

Want to write plugins but can't afford CodeWarrior? See here how to use Apple's free MPW instead!

Collection Extension (68K/PPC, Windows)

This plugin adds a method to read back the Keys that are stored in a Collection object, similar to the available "Item" method that returned the values from a Collection.

The plugin works with Mac OS (68K, PPC) and Windows (x86).

Download here (50 KB), complete with source code, documentation and testing code.

Bit Ops (68K/PPC/Carbon, Windows)

This plugin adds methods for many useful bitwise operations on Integers.

It also provides a new class TTsBitSet that handles large arrays of bits.

Here's an incomplete list of the provided functions: And, Or, XOr, Not, Nor, Nand, Shift, Rotate, Clone, Copy, Compare, Find.

The plugin should work under Mac OS (68K, PPC) as well as under Windows (x86).

Updated Feb 6, 2000, to v1.0.1: The NOR and NAND operations did not work correctly in v1.0.

Updated May 3, 2003, to v1.1: Carbon version now available, and a little bugfix: Shift operations with more than 31 shifts at once do now produce correct results.

Updated July 20, 2003, to v1.1.1: Carbon version works really now (in v1.1, the Carbon support was not existing - don't ask me how that happened)

Download here (88 KB), complete with source code, a brief documentation and testing code.

CRC Calculation (68K/PPC/Carbon, Windows)

This plugin adds methods for calculating CRCs (checksums) in 16 and 32 bit, as well as variably from 16 to 64 bit.

Works under Mac OS (68K, PPC), Mac OS X (Carbon) as well as under Windows (x86).

Updated Mar 15, 2003 to version 1.2: Added Carbon (OS X) support

Download here (88 KB), complete with source code, documentation and sample code.

FolderItem Extension (68K/PPC only)

Adds the following methods to the built-in FolderItem class:

Download the plugin (37 KB), complete with source code, documentation and sample code.

TTsEventMonitor Class (68K/PPC only)

This plugin lets you monitor events that your app receives, like key presses, mouse clicks and idle events. You can even modify or filter those events entirely.

For example, you can detect Function Keys because their Keycode is available to you via this plugin now. You can also detect and Key presses in conjunction with the Command Key before RB processes them any further, allowing you to support Cmd-Cursor combinations and others that are not included as menu bar shorcuts.

Updated Aug 10: Added a demo project that lists all events the plugin receives.

Download the plugin (41 KB), complete with source code, documentation and sample code.

MacAliasRecord Class (68K/PPC only)

Do you need to save the location of a FolderItem in your Preferences file and retrieve that item later again when your app is relaunched?

Do you currently solve this by saving the AbsolutePath property of the FolderItem?

Here's why you want to use this class for this task:

If the user moves or renames the item, the saved absolute path will not be valid any more, and the item would be lost. However, using the MacAliasRecord to save and retrieve a FolderItem location, you will most likely be able keep the reference to the item, similar to a Alias file that you can create in the Finder. As a bonus, you can even locate items on removable and to network volumes, providing the user with the login dialog to the server.

Download the plugin (50 KB), complete with source code, documentation and sample code.

MemoryBlock Extension (68K/PPC/Carbon, Windows)

Current version: 1.9 (Apr 9, 2003)

Adds the following methods and properties to the built-in MemoryBlock class:

The following global methods are also available

Download the plugin (187 KB), complete with source code, documentation and sample code.

Application Framework (REALbasic code)

Do you need a starting point for a application that uses multiple document windows?

Do you want to maintain a menu that shows a list of the open windows?

Do you have documents that you need to save when closed and thus need to write code that asks the user whether he wants to save, discard or cancel?

Then get TT's App Frame (11 KB). It is a RB1 compatible project with documented source code that takes care of all this for you.

Icon To Picture (68K/PPC only)

Convert Icons (1, 4, 8 bit depths only, no 32 bit support yet!) from anywhere (not only from resources) into Pictures with this plugin (26 KB).

Note: If you need to get icons of files and olders, just like the Finder shows them, I recommend taking a look at Micono's Icon plugins, particularly his GetFinderIcon, and to Doug Holton's FileIcon Plugin (Doug's comes with source code for the plugin, while Micono's seems easier to use).

Exception Handling (Tutorial, text)

This is a text I wrote on a nice sunday morning (March 14, 99) in about 2 hours to explain how to make your code safer using Exception Handling.

Updated on July 26, 99: The example for using a Constructor has been corrected.

This page shows the text, then you can save it to your hard disk if you wish.

J-flag Thanks to Ryo Amano, there's also a Japanese version of this text available.

Array & ListBox Sorting (REALbasic code, not a plugin)

A class that implements QuickSort and BubbleSort. It can sort any type of data: You need to subclass this class and then implement a Compare and a Swap function. The Sort class does the rest for you. It comes with lightly documented source and demonstration code.

This is an updated version (36 KB) that works with RB 2006r2 and later. Thanks to Tony Rich for making the necessary changes.

Searching for certain files on a Mac OS volume (68K/PPC/Carbon)

This plugin implements the PBCatSearch function of the Mac OS File Manager. This is a very fast routine to find specific types of files on a volume. The MacOS tool Sherlock (aka Find File) uses this function to do its quick search on volumes.

This plugin also shows how you can allow your RB app to access complex data structures inside the plugin without having to create a REALbasic Control or Class, something that is not yet possible for Windows plugins (the trick is that you create a temporary structure inside the plugin and then provide accessor functions to get and set the individual elements of that structure).

Current Version: 2.2.1 (June 19, 2005)

New in 2.2.1 (since 2.1):

Download (170 KB) this plugin with Source code (both C and REALbasic code)

Mac OS File Manager support (68K/PPC only)

This plugin gives you access to some functions of the Mac OS File Manager, such as relating RB's FolderItems to a Volume Reference Number (VRefNum), checking for Server volumes, getting & setting more information about files (File Flags and Attributes) and getting, creating and resolving FileIDs & DirIDs.

One of the functions is particularly helpful: RB 2.0 (and before) crashes when you open and then again close the resource fork of a file that was already opened by you or by the RB IDE. To prevent that, you can use IsResourceForkOpen before you open the resource fork and then do open it (and tell the user that you can't do it).

Updated June 17, 01 to version 1.3.1:

Download (44 KB) this plugin with Source code (both C and REALbasic code)

And here's a carbonized version made by Jean-Francois Roy

Hiding the Menu Bar and the Control Strip Bar (68K/PPC only)

This plugin allows you to hide the Menu Bar and anything else that would obscure the screen if you wanted to draw on the full screen, like the rounded corners, the Application Switcher floating window and the Control Strip bar.

Additionally, you can show and hide the Control Strip bar individually.

Two other valuable features of this plugin are:

Current Version: 1.1.1 (June 1, 99). Features:

Download (49 KB) this plugin with Source code (both C and REALbasic code)

DLL Plugin Postlinker

This is only of interest to those who write their own plugins.

This postlinker was originally written by me to ease the creation of Windows (x86) plugins. Using this postlinker, that is an add-on for the CodeWarrior system, you can create the x86 plugins in one step. To see how this works, get the Plugin Starter of mine or see the Plugin API examples from REALsoftware, who now include a version of this postlinker, too.

The current version is 1.3.2. It supports the Carbonized CW versions, that is CW Pro 7 and later, including Pro 9. If you are using CW Pro 2 to 6, you need version 1.3 instead.

My thanks go to Patrick Perroud and Nicolas Zinovieff for providing v1.3.1, and to Bob Delaney and Steven Smith for making v1.3.2 available.

Download v1.3.2 for CW Pro 7 and later here (includes Source code).

Download v1.3 for CW Pro 2-6 here (includes Source code).

Gestalt Manager support (68K/PPC only)

Gestalt codes in MacOS are global settings, similar to environment variables in Unix and DOS.

Many applications and system extensions install a so-called Gestalt Selector that give other apps and the user some information about their state.

As an example, Mac OS always installs a Gestalt Selector with code "sysv", which returns the currently running system version.

Current Version: 1.0 (March 8, 99)

Note: This plugin becomes obsolete in RB 2.0.1, which offers a built-in function for this task ("System.Gestalt").

Download (23 KB) this plugin with Source code (both C and REALbasic code)

Debugging helper (68K/PPC/Windows)

Provides a "Log" function that outputs a string to a debugging console, which is DCon on Mac and something like DebugView on Windows. This allows you to add instructions to your code and see them on the text logged by an RB-independent tool, allowing you to even see what's going when your RB app should crash right after the output.

Download this plugin with Source code. Current Version: 1.0 (Feb 18, 2001)

Entering Low-Level debuggers like MacsBug (68K/PPC only)

Do you know what MacsBug is? If not, forget about this plugin or read about it on the MacsBug page at Apple.

If you have MacsBug installed, this plugin lets you enter MacsBug by the debugger traps Debugger() and DebugStr(). This can come handy if you need to track down some low-level stuff within your RB app, like tracing the order of events.

Note: You only need this plugin for RB version 1. Version 2 (actually v2.0.2) gives you a better way to call the Debugger by using the following declaration inside your methods:

Declare Sub Debugger Lib "InterfaceLib" Inline68K("A9FF")
Declare Sub DebugStr Lib "InterfaceLib" (msg as PString) Inline68K("ABFF")
      

Download (22 KB) this plugin with Source code (both C and REALbasic code), current Version: 1.0 (March 8, 99)


 


REALbasic Plugins webring - find more plugins here

This REALbasic Plugin Webring site is owned by Thomas Tempelmann.

[ Prev | Next | Random | Next 5 | List Sites ]


REALbasic webring - links to many other RB users

webring
This REALbasic Webring site is owned by Thomas Tempelmann

[ Previous | Next | Next 5 Sites | Random Site | List Sites ]


Links to my other pages

Homepage

Macintosh user tools

Macintosh developing tools and information


Thomas Tempelmann, last update: Dec 10, 2020