Special

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 19 in printed book and digital formats -- plus a one-year subscription (beginning with 20.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 2.3

COLUMN

Comparing Interfaces

Get comfortable using REALbasic

Issue: 2.3 (December/January 2003)
Author: Owen Yamauchi
Author Bio: Owen Yamauchi is a freelance programmer who has been programming REALbasic since version F4. He is the Lead Programmer for Domain Softworx, a company that produces developer tools for REALbasic.
Article Description: No description available.
Article Length (in bytes): 8,965
Starting Page Number: 43
Article Number: 2321
Related Web Link(s):

http://www.domainsoftworx.com/

Excerpt of article text...

Visual Basic (VB) is the Windows implementation of BASIC. It is very popular among novice programmers, and it has what is probably one of the largest third-party communities of any development environment. If you're a REALbasic (RB) user, you may have heard of or used some of RB's VB-related features. RB can directly import certain VB files, and there is even an external application that aids in converting VB projects into RB projects. One of the aims of this column is to help you with that task.

If you're a VB user just learning to use RB, you may feel out of place in RB's integrated development environment (IDE). RB and VB have very different interface layouts. Here, we will compare VB 6 (not VB.NET) to the latest version of RB, which at the time of writing is 5.2.1.

One thing that may seem odd to VB programmers is that RB stores projects as one single file. In VB, projects are spread over multiple files: all forms, modules, and other items are stored in individual files. You will probably find this restricting at first, but as you get used to it you realize that it's not restricting at all, and it reduces hard drive clutter as well. RB's Project window (the window showing all items in the project) provides an adequate overview of the project. In case you do want to store an item as a separate file, simply dragging the item onto the desktop or into a folder will create a separate file for it, so you can import it into other projects.

It is also necessary to learn some of RB's vocabulary in comparison with VB's. For example, what are called "forms" in VB are "windows" in RB. From now on, we will use the RB terms in this column, and if we are introducing a term for the first time, we will provide the translation.

Sometimes you will find that the built-in functions of RB are not enough for your needs. You can turn to the large third-party community of RB developers, and it is likely that someone has written some code that will help you, or you will find someone willing to help you write some. The existing code can come in a number of ways. The two main ways are classes and plugins. Classes will be familiar to advanced VB users, and users of other object-oriented languages. At their simplest, they are objects that can store and process data. Plugins are a new concept for VB users, who are used to adding additional functionality to their programs by adding references to system libraries (DLLs). This is actually possible in RB through Declare statements, which we will go over in detail in a later column. Plugins are special files placed in RB's Plugins folder, and they can add new methods, controls, and classes. There is no limit to what these plugins can accomplish -- they can interact with the operating system in ways that RB code can't, for example.

When you first open up RB's Code Editor, it will appear strange to the VB user, who is used to seeing all the window's code in one big block. It is a matter of personal preference whether you prefer VB's or RB's layout. RB organizes the code by its category. Categories include Controls, Events, Menu Handlers, and Methods. Controls contain code that responds to mouse and keyboard events (clicks, mouse moves, key presses, etc.) in controls including buttons, text fields (called EditFields in RB) and scrolling lists (called ListBoxes in RB). The Controls category is only seen in windows' Code Editors. Events contain code that responds to mouse and keyboard events in the parent object (the window or class). A simple way to identify the parent object is to look at the Code Editor window's title: "Code Editor (Window1)" signifies that Window1 is the parent object to which the events refer. Menu Handlers are precisely that -- they contain code that is triggered when a menu item is selected. Methods are basically anything else -- functions that can be called from code, but are not triggered by the user. Some VB users may be thinking of "subs" -- these are methods that don't return anything, as opposed to functions. We mention these distinctions because VB users are used to seeing code all together, and it may be confusing at first to find the specific part they want if they are not familiar with this category system.

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