Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 6.5


Custom EditField 1.4

Issue: 6.5 (July/August 2008)
Author: Brad Rhine
Article Description: No description available.
Article Length (in bytes): 4,189
Starting Page Number: 9
Article Number: 6505
Related Web Link(s):


Full text of article...

The EditField control included in REALbasic gets a bad rap sometimes. Sure, it doesn't support syntax highlighting, autocomplete, or undo. But when it comes down to it, it was never meant to do those things. It was just meant for basic data entry and the occasional editing of small chunks of styled text. A lot of REALbasic developers have even asked for REAL Software to make the code behind their code editor available. Other solutions are out there, such as the Formatted Text Control from True North Software, WordGuise from Van Hoek Software, and the now-mostly-defunct WASTEField.

If you want to move beyond those basic capabilities, you need to look at a custom control.

That's where Alex Restrepo's Custom EditField 1.4 comes in. Custom EditField is a canvas-based control that goes far beyond what the standard EditField can do. To sum it up, it's what the EditField wants to be when it grows up.

For starters, Custom EditField includes some cool syntax highlighting. Out of the virtual box, it has syntax definitions for C, HTML, Java, Objective-C, PostgreSQL, REALbasic, TransactSQL, XML, and Yuma. That's a pretty impressive list, but if you find it to be inadequate, you can easily add your own, since the syntax definitions are just XML files. Syntax definitions can contain keywords or regular expressions, which can be styled and/or colored (text or background color) based on your specifications.

Custom EditField also optionally supports autocomplete, based on a list of keywords that you can provide. You can trigger autocomplete by using the ShouldTriggerAutocomplete event, which makes it dead simple to define the key you want to use for autocomplete.

Undo is also built into Custom EditField, and it works as expected. While that may seem like faint praise, undo is one of those features that's almost unnoticeable when it's working correctly, but sticks out like a sore thumb when it's not.

Another great feature is optional line numbering. And next to each line number, you can display a line icon, which is great for displaying syntax errors or highlighting important information.

But that's far from a complete list of features. Custom EditField also provides line foldings, which allow the end user to collapse and expand blocks of code (think code folding in the REALbasic IDE). It can hide or display invisible characters, it can highlight matching brackets, and it can automatically close brackets. You can also choose to have new lines auto-indented.

You might expect Custom EditField to be fairly costly, given its extensive list of features. But you'd be wrong on that one. Custom EditField can be used, free of charge, in any of your projects if you're willing to use the encrypted classes, as long as you give some credit to Alex Restrepo (in your documentation or about box). If you want the full source, Custom EditField is still a bargain at $100. And since its original public launch earlier this year, the developer has been busy fixing issues and adding features.

This is a class that I recommend without reservation.

End of article.