Migrating from PowerBASIC

PowerBASIC use a language very similar to the Xojo language. You will notice that many of the commands are nearly the same, but there are differences as well.

Unfortunately, PowerBASIC appears to no longer be updated by PowerBASIC Inc with no new updates since 2012 and no further updates planned. For those that need a more modern compiler that is both similar and actively updated, Xojo is a good fit.

Xojo uses the open-source LLVM compiler to generate 64-bit builds with several optimization settings. The Xojo language is similar to BASIC, but is more advanced and fully object-oriented. Xojo has a robust layout editor so you won't have to tedously create your user interfaces in code. And lastly, Xojo supports multiple platforms. The Xojo IDE itself can run on Windows, Mac and Linux. And Xojo can create these types of native apps:

  • Desktop apps for Windows, Mac, Linux and Raspberry Pi

  • Console apps for Windows, Mac, Linux and Raspberry Pi

  • Web apps for Windows, Mac, Linux and Raspberry Pi servers

  • iOS apps for iPhones and iPads

Comparison to PowerBASIC

Based on PowerBASIC online docs from here: http://www.powerbasic.com/help/pbwin/wf_njs.htm

When first released in 1998, Xojo was originally called REALbasic, which ought to highlight the origin of its BASIC-like programming language. But even then, Xojo was more advanced that your typical BASIC.

Today Xojo is a modern, object-oriented programming language in its own right that should feel very familiar to users of PowerBASIC.

The Xojo integrated development environment

Xojo utilizes a powerful, modern IDE for creating your apps. The main areas of the IDE are the Project Navigator that appears on the left and the Library/Inspector that appears on the right. In the center you'll see either the UI Layout Editor or the Code Editor. The Code Editor has full syntax highlighting with auto-complete.

The Layout Editor lets you easily create your user interfaces using drag and drop. For more information on the Xojo IDE:

  • Navigator

  • Library

  • Inspector

  • Code Editor

  • Layout Editor

Programming language

The language syntax of PowerBASIC is very similar to Xojo. You 'll see familiar syntax for If..Then..Else, For..Next, While..Wend, Dim and many other commands. Someone who has used PowerBASIC will have no trouble understanding the Xojo programming language. Some other information about the Xojo Programming Language:

  • Strongly typed

  • Fully object-oriented

  • Uses Automated Reference Counting for memory management

  • Compiles to native machine code

Data types

Although Xojo data types are not always named exactly the same as PowerBASIC data types, all the equivalent types are there. For example, Integer is equivalent to a PowerBASIC Long (for 32-bit apps) and PowerBASIC Quad (for 64-bit apps). Here is a mapping of some PowerBASIC data types to Xojo data types:

PowerBASIC Data Type

Xojo Data Type

n/a

Boolean

BYTE

UInt8

WORD

UInt16

CUR

Currency

DATE$

DateTime

DOUBLE

Double

INTEGER

Int16

LONG

Int32

DWORD

UInt32

QUAD

Int64

SINGLE

Single

STRING, WSTRING

String

VARIANT

Variant

Variables and variable scope

Xojo is strongly typed, so all variables must have a defined type.

Related Documentation topics:

  • Variables and Constants

Operators

Xojo has arithmetic and relational operators that are equivalent to what PowerBASIC has. You can read more about them in the Reference Guide:

  • Operators

  • Operator Precedence

Error Handling Like PowerBASIC you can have both compile-time errors and runtime errors. Compile-time errors are displayed in the Errors panel when you run your project. Clicking on an error takes you to the line of code in error.

For handling runtime errors, Xojo uses something a bit more modern than ON ERROR GOTO called Exception Handling. Essentially, when a runtime error occurs, an exception is raised. Your code can "catch" the exception in order to handle the error. There is even a global event that can be used to catch any error.

Controls

Unlike PowerBASIC, Xojo uses a powerful layout editor for creating your user interface layouts. The default UI controls included with PowerBASIC are, for the most part, also included with Xojo, but Xojo also has several controls that are not included with PowerBASIC.

Here is a list of some PowerBASIC controls and their Xojo equivalents:

Because Xojo is object-oriented, any of its built-in controls can be subclassed to add features or change their behavior. In addition, Xojo has ContainerControls which can be used to create your own controls by combining other controls.