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 14 in printed book and digital formats -- plus a one-year subscription 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


Beginner's Corner


Working with TextField Masks

Issue: 8.5 (July/August 2010)
Author: Marc Zeedar editor-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 11,875
Starting Page Number: 53
RBD Number: 8508
Resource File(s):

Download Icon 8508.zip Updated: Monday, July 5, 2010 at 4:47 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

An often overlooked but extremely powerful feature of REALbasic's TextField control is its mask property. The mask allow you to specify, in advance, what types of data the field can handle. It's great for forcing data to be well-formatted, such as telephone numbers and Zip codes that have a specific format (though you should be aware that different countries often have different formatting). However, masking is so powerful it can be intimidating if you haven't used it, so today we're going to explore the feature in detail.

In principle, masking is simple. You just build a string of placeholder characters and stick it in a textfield's mask property. You're done. In practice, those placeholders can be tricky business and you may still need to check for errors and do some post-entry data massaging.

In the Old Days

Before the mask property was added to REALbasic, getting data entered into a specific format was difficult. You either allowed the user to enter whatever they wanted and then did analysis on the result, editing the data programmatically to force it into the right format, or you had to create your own subclass of a textfield that wouldn't allow certain characters to be entered (i.e. non-numbers in a number-only textfield). (For an example of this, see the "RestrictedField" sidebar.)

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.




Weblog Commenting and Trackback by HaloScan.com