Various topics both uselessly general and mind-numbingly specific.

REALbasic free sample code

Posted by Mile23 in

NOTE:

This code is old and cranky. It spends all day living under a bridge, dreaming of the days that once were. That kind of code. I don't have plans to update it, but please leave a comment if you have any questions.

My REALbasic Stuff

I've made a few plugins and reusable classes for my projects. None of them really represent any quantum leaps forward, but I made them and I want to offer them to the REALworld.

What Is REALbasic?

REALbasic is a development environment for Macintosh, which can compile for both Macintosh and Windows32. It uses an object-oriented implementation of the BASIC language.

Plugins

My plugins get their own separate page.

Reuseable Classes

Class name: Description: Download:
AquaAwareMenuItem

AquaAwareMenuItem is a MenuItem subclass that splits the EnableMenu event into two new events: the EnableMenu event and the AquaEnableMenu event. AquaEnableMenu is triggered if the application is running under Aqua; EnableMenu is triggered otherwise.

The distribution includes some useful subclasses of AquaAwareMenuItem, including one which can use the Aqua Application->Preferences menu item automatically. Download and see.

AquaAwareMenuItem.sit
Current version: 1.1.0
(req: RB 3.x and AquaPrefMenuEnable plugin)
FileURLConverter

An object class that takes a FolderItem and converts its path to a file: URL.

Updated 2002/11/17 with proper MacRoman/ISO Latin 1 conversion.

FileURLConverter.sit
Current version: 1.0.1
(req: RB 2.1.2)
m23NotifierModule and NotificationRec

A package of wrapper classes for the MacOS Notification Manager. Use these classes to play a system beep, flash an icon in the menu bar, put a diamond mark next to your application's name in the Application Menu, and display a dialog notifying the user of something important.

m23notifiermodule1.sit.hqx
Current version: 1.0.0
(req: RB 2.1.2)
SelectAllEditField and FindableEditField This is a package of three subclasses which implement a select all, select none, find, find again, and find and replace in an EditField. One of the classes is a modal dialog, which is the most complicated part. findableedit.sit.hqx
Current version: 1.0.0
(req: RB 2.0.2)
CivilWindowMenu A demonstration of how to make a dynamic Window menu for your app. Window names are in the menu in the order they were opened, and there's a check mark next to the topmost one. Someone on comp.lang.basic.realbasic was interested in this, so here it is. civilwindowmenu.sit.hqx
(req: RB 2.1.1)
ErrorException A demonstration of how you might be able to use custom exception classes to more easily debug and show errors to a user. Also includes a module for making log files. errorexception.sit.hqx
(req: RB 2.1.1)
ProcessList and ProcessRec

These classes are essentially RB wrappers for a few Toolbox calls dealing with running processes. If you wish to delve into the guts of these classes, or to find out anything at all about how MacOS treats running processes, check out Inside Macintosh: Processes.

Version 1.4 adds Carbon compatibility. Note that my MacAppProcess plugin does a lot of what these classes do, but make it much, much easier.

Some uses for these easy-to-use classes:

  • Finding your program's FolderItem
  • Sending your program to the foreground
  • Sending any running process to the foreground without Apple Events
  • Finding out how much memory your program has and is using
  • Finding out how many processes are running
  • Finding out how many processes of a given type are running
  • Finding out which process launched any given process
  • Access to MODE/SIZE information for any given process (CanBackground, DeskAccessory, HighLevelEventAware, etc.)
  • Learning about Toolbox calls and MemoryBlocks in REALbasic by finding my bugs :-)

ProcessRec now uses Thomas Tempelmann's MemoryBlock plugin to get the folderItem for the process. You should download this plugin, because you'll eventually need it anyway.

processlist.sit.hqx
Current version: ProcessList 1.4, ProcessRec 1.4
(req: RB 2.1 and MemoryBlock Plugin)
DesktopDatabaseAccess A demonstration of how one might possibly implement a class wrapper for the Mac's Desktop Manager. The classes in this project can:
  • Tell you if the Desktop Manager knows about a given program
  • Return the Finder comments for a given file

No guarantees are given or implied. :-)

desktopdatabaseaccess.sit.hqx
(req: RB 2.1.1)
ColorSwatch Still more clunky attempts to implement custom controls. :-) This one makes something vaguely resembling the color picker in Photoshop. Later versions may add the 'swap colors' button. Uses the ClickSoundCanvas class, which is included in the archive. ClickSoundCanvas plays Appearance Manager sounds for clicks. colorswatch.sit.hqx
Current version: 0.9.0
(req: RB 2.0.2)