Yonk icon

REALbasic Source Code

Yonk is written in REALbasic, an object-oriented language similar to Visual Basic. I've tried to make Yonk as object-oriented as possible, and several components of Yonk's source code are available as their own stand-alone projects. Some of the code below may not actually be in the current release of Yonk (yet).

Some of the projects on this page are available under the GNU General Public License. The GPL is a source of much anxiety for some, so I've explained why I'm using it here.


Undo Toolkit 1.3.1
27 June 2005
GNU General Public License
(As featured in Issues 1.2 and 1.4 of REALbasic Developer magazine. RBD subscribers can download the tutorial files from the subscribers-only web site.)

Undo Toolkit allows you to add undo and redo to your REALbasic project with just one line of code per control. Just change each control's "super" to its Undo Toolkit counterpart, add one line to set the EditUndo menu text, and you've implemented a fully featured undo system in a fraction of the time.

The Undo Toolkit includes window classes that automatically prompt the user to save changes (using a MacOS X sheet window), manage the MacOS X Aqua change flag, enable and handle the FileSave, EditUndo and EditRedo menu items, and support unlimited levels of undo with unlimited numbers of controls. Undo Toolkit supports application-wide or window-specific undo—you can choose the undo solution that's right for your project—and provides customizable language constants for multi-lingual apps.

What's New in Version 1.3.1

[New] UndoStack: When calling a control's Undo method, now moves the control's window to the foreground, and if necessary sets the value of the control's TabPanel or PagePanel to make the control visible.
[Fix] UndoStack: Fixed a bug where the "dirty" boolean was improperly set FALSE if the user performed an action while there were no actions to redo.
[Fix] Application-wide Undo: Added documentation about menu handling code needed in the App.EnableMenuItems event.
[Fix] UndoableEditField: Now captures the styles of text dragged into an UndoableEditField from another application, instead of just capturing the text.
[Kis] UndoableEditField: The StyledText object associated with text dragged or copied from another application will have incorrect color settings and will not honor the bold setting, due to a bug in REALbasic itself (Feedback ID: jrnziewx). This will become visible after undoing and redoing the insertion of styled text.
[Fix] UndoableEditField: Fixed a bug where an undo or redo could change the style settings of a non-styled UndoableEditField.
[Fix] UndoableEditField: The Modified event no longer fires when pressing the backspace key while the cursor is at position zero.
[Fix] UndoableEditField: Now checks whether StyledText = nil instead of relying on the value of the styled property, which apparently returns TRUE when it shouldn't under certain (not yet isolated) conditions in a compiled Windows app.
[Fix] Compiler: Removed some REALbasic 5.5-specific syntax (e.g., "dim x as new y") for better compatibility with REALbasic 5.0 and higher.
[Chg] Debugging Tools: Renamed UndoStackDisplay to UndoStackViewer.
[New] Debugging Tools: Added the StyledTextViewer class, which displays the contents of a StyledText object. You can click on a StyledText object in the UndoStackViewer to display its contents.

Classes included in this download:
  • The UndoableAction class, with subclasses
    • InsertAction
    • RemoveAction
    • ChangeAction
    • MoveAction
    • StyleAction
  • The UndoGlobals module.
  • The UndoProvider class interface, with controls that implement UndoProvider:
    • UndoableCheckBox
    • UndoableSlider
    • UndoablePopupMenu
    • UndoableComboBox
    • UndoableRadioButton
    • UndoableGroupBox
    • UndoableListBox
    • UndoableEditField
  • The UndoStack class.
  • The UndoWindow class, with supporting classes:
    • SavePrompt
    • SavePromptConstants
  • Support classes:
    • DropTextTimer
    • RuntimeExceptionPlus
    • StyledEditField
  • Debugging tools:
    • UndoStack_Debug
    • UndoStackViewer
    • UndoWindow_Debug
    • StyledTextViewer

Requirements:

  • REALbasic 5.0 or higher.

Download Undo Toolkit

StyledEditField 1.0
9 April 2005
Public Domain
StyledEditField is an EditField subclass which implements the SelStyledText property, allowing you to read or write the EditField's current selection as a StyledText object.

Requirements:

  • REALbasic 5.0 or higher.

Download StyledEditField

RuntimeException Plus 1.0
24 January 2005
Public Domain
This module extends the built-in RuntimeException class to better support collecting a stack trace from a built application. It adds the following methods and "properties" (they're really methods, but they behave like properties) to RuntimeException:

Method:

  • Cascade(MethodName as String)
    Escalates the RuntimeException to the next-highest level exception handler, and adds the current method's name to the stack trace.

Properties:

  • StackTrace
    A String containing the RuntimeException's stack trace, as constructed by invoking the Cascade method at each level of the stack in the running application.
  • Type
    A String containing the RuntimeException's type (e.g., "NilObjectException").

See the demo project for examples and instructions.

Requirements:

  • REALbasic 5.0 or higher.

Download RuntimeExceptionPlus

Yonk 1.0b6 source
29 August 2003
GNU General Public License
This is the full source tree for Yonk 1.0b6. In addition to the packages listed below, the Yonk code includes classes, threads and windows for reading the contents of an Inform source file, storing it as a hierarchical list of REALbasic objects, editing and saving these objects, displaying a map of connected rooms, handling menus and windows, and other related code. You should be able to compile the full Yonk application from this source.

Requirements:

  • REALbasic 5.2 or higher.
  • Kevin Ballard's CFPlugin plugin.
  • Kevin Ballard's "Carbon Declare Library" (included).
  • A modified version of Frederik Seiffert's "CFPreferences" class (included).
  • A modified version of Noah Desch's "ControlOps" class (included).

Download Yonk Source

Aqua About Box 1.1.1
27 July 2003
Public Domain
This project provides an About box template that follows Apple's Aqua Human Interface Guidelines down to the pixel, so that your application looks and feels like a good MacOS X app should. The Aqua HI Guidelines specify exactly the layout, font sizes and spacing of an about box, so downloading this project will save you an hour or two of tweaking.

Thanks to Amar Sagoo at The Interface Mafia for the article that inspired this project.

New in version 1.1: AquaAboutBox is now a "one size fits all" template, instead of having hard-coded small, medium, and large versions. Set or unset the provided constants and the AquaAboutBox will grow or shrink as needed. AquaAboutBox has also been integrated into the YFrame application framework; this download includes the full YFrame_kAppConstants module, of which the AquaAboutBox uses a subset.

27 July 2003 update: Version 1.1.1 cheerfully steals two features from Seth Willits's newly announced OS X About Window project: Support for selected HTML tags and the Edit menu's "Select All" credits in the About box credits field. Seth is keeping me on my toes!

Requirements:

  • REALbasic 4.5 or higher.

Download AquaAboutBox

YFrame
10 May 2003
GNU General Public License
YFrame is a REALbasic code template for document-centric applications. It's designed for MacOS X, but should be compatible with MacOS 9 (and, partially, with Windows). YFrame includes the latest versions of several projects that are listed separately below (including UndoToolkit, AquaAboutBox and BugReport), so if you want the whole works in one download, this is it.

YFrame provides the following features and functionality:

  • A fully implemented Undo system, which the developer can configure to support single or multi-level Undo (and Redo), on a per-document or application-wide basis, according to the needs of the application.
  • Built-in support for reading and saving Preferences, using a Toolbar control under MacOS X and a TabPanel under MacOS 9. Preferences are saved in Apple's XML-based .plist format, using the Carbon toolbox routines. Includes support for storing FolderItems in the prefs file, using RB 5's GetRelative and GetSaveInfo methods.
  • Camino-style exception handling within the application, prompting the user to enter details about the problem and then invoking the user's e-mail client to send a bug report to the developer. The develper can also call the crash reporting system manually, providing additional details about the exception and the program state at the time of the problem.
  • A Help menu that includes links to the application's home page, its online documentation, and allows the user to e-mail feedback to the developer.
  • Document windows that automatically track their save state (when using a per-window Undo system) and prompt to save changes when required, using a dialog sheet in MacOS X. Support for windows with hierarchical parent-child relationships, so that closing Window 1 also closes Window 1.1 (and prompts to save changes in either window, as required).
  • Built-in support for the Carbon "Window" menu, pending REAL Software's fix of bug 'kswhfqar'.
  • An About Box template conforming to Apple's Aqua Human Interface Guidelines. The developer can set the contents of the About Box by defining the appropriate constants, and the template will size itself accordingly.
  • Extensive localization support with language-specific string constants.

Requirements:

  • REALbasic 5.1 or higher.
  • MacOS X 10.2 or higher or MacOS 9 with CarbonLib.
  • Kevin Ballard's CFPlugin and the indispensable Carbon Declare Library.
  • A modified version of Frederik Seiffert's "CFPreferences" class (included).

Download YFrame

Bug Reporter
9 November 2002
Public Domain
This window class allows your application to create and send bug reports by e-mail, using the System.Gestalt call to collect system information, and the ShowURL method to invoke the user's e-mail application and send a message. The user can optionally enter a description of the problem. The class is designed to be part of your exception handling code, but it can be used from anywhere in your application.

Requirements:

  • REALbasic 4.5 or higher.

Download BugReporter

HierListBox 4.5.1
8 September 2002
GNU General Public License

This is the latest evolution of what was once Theo Smith's "TreeVar and HierListBox" project; I've now rewritten it from the ground up, and turned it into a subclass of REALbasic 4.0's ListBox instead of a Canvas. It implements a true hierarchical list, with dragging and dropping of list elements (using the correct Appearance Manager sounds), cutting, copying and pasting (including maintenance of the Edit menu while the HierListBox has the focus), custom events for reading and writing list elements to/from the Clipboard, anti-aliased text under MacOS X, and more.

See the notes and comments throughout the code for more information.

Requirements:

  • REALbasic 4.5 or higher.
  • UndoToolkit 4.5.1 (included).
  • Noah Desch's Controls module (included).
  • Thomas Tempelmann's TT's MemoryBlock plugin.

Download HierListBox

Back to main page