Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

The Basics of REALbasic, Cross-platform RAD Tool in the Mold of VB : Page 3

Learn the ins and outs of REALbasic, an application development environment for creating native applications and utilities. Its cross-platform capability makes it easy to compile the applications and utilities you create on one platform and run them on another.


advertisement
Testing Your App
Figure 7. Entering a Breakpoint: Breakpoints can be added in the integrated debugger.
Let's explore the integrated debugger. Quit the debug application and go back to the code editor for Pushbutton1.Action. The column to the left of the code has some small horizontal lines that indicate places where you can place breakpoints (see Figure 7). Use the mouse to click on your line of code and place a breakpoint.

Run the debug application, enter some text, and hit the Add To List button. The IDE comes to the front, a new Run tab appears, and the line of code where you put the breakpoint is highlighted. Instead of the properties list on the right side, you now see a variables list (see Figure 8).

Figure 8. Code Variables: The debug application lets you test your code's variables.



Click on Window1.Window1, which will display all the properties for Window1. Then click on Contents, which shows you all the objects on this instance of Window1 (see Figure 9). From here, you can view any of the properties of any of the controls on this window.

Take some time to explore all the controls. In particular, click on the EditField1.EditField to see its properties. Scroll down to the Text property and you'll see that its text is the same as what you typed into the editfield. You can change the text by clicking the magnifying glass. Click the Resume button at the top of the window to continue.

While this isn't a practical example, it demonstrates how REALbasic works and how easy it is to get started. From this point, you could use the standard REALbasic database or XML classes to create your own document format, read/write the data, and make a simple "to do" application.

Figure 9. Table of Contents: The Contents box reveals all the objects of any variable in your code.

Platform Neutrality—with a Couple 'Gotchas'
The professional version of REALbasic allows you to write on the platform of your choice and then easily run and debug in another environment. For example, I wrote most of the example project for this article on Macintosh OS X, but I ran and debugged it in Windows and Ubuntu while running VMware.

Don't fret if you're a Windows or Linux user—you can work the opposite way as well. The test environment need only run a simple application called the Remote Debugger Stub (appropriately written in REALbasic). However, be aware that controls on Linux are a little bigger than they are on Macintosh and Windows. One way to get around this is to add code in the Open events of the pushbutton and editfield controls and target Linux builds specifically to change their heights:

#if TargetLinux Then me.Height = 26 #endif

This isn't a very efficient solution though, nor does it make good use of REALbasic's ability to subclass controls. In a real application, I would create editfield and pushbutton subclasses that changed their heights automatically at runtime. I might even use a global constant, so I would have to change the height value in only one location.

It's also important to remember that nearly all REALbasic controls are a compromise. There are controls available for Windows that have many features not found on the Macintosh and Linux platforms (and visa versa), so don't expect to get your favorite ActiveX multi-column, drop-down combo box to be native (i.e., cross-platform) in REALbasic. Most of these things you can certainly build, but will be a lot of work. And while REALbasic for Windows does support some ActiveX, it's not fully supported.

There is also an active third-party market for REALbasic controls, classes, and modules if you need features that REALbasic doesn't have out of the box. I recommend looking at the Monkeybread Software plugins, which extend REALbasic with around 20,000 additional functions for Mac OS X, Windows, and Linux. For additional cross-platform controls, I recommend the Einhugur controls. To find additional REALbasic controls, classes, modules, source code, consultants, and tutorials, search RBGarage.



Bob Keeney is founder and vice president of BKeeney Software. He is a regular contributor to REALbasic Developer Magazine and president of the Association of REALbasic Professionals.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap