Realbasic (RB) is the object-oriented dialect of the BASIC programming language used in Real Studio, a programming environment, developed and commercially marketed by Real Software, Inc of Austin, Texas for Mac OS X, Microsoft Windows, 32-bit x86 Linux [1] and the web [2][3]
Contents |
Realbasic is a strongly typed language with minimal automatic type conversion, which supports single inheritance and interfaces, class methods and class properties, automatic memory management via reference counting, and operator overloading. A very important feature is the ability to extend (not just inherit from) existing classes, like Objective-C Categories. This considerably reduces the need for the Abstract Factory Pattern, which complicates using Application Frameworks in Java and C++. Realbasic also includes delegates, introspection, and namespace support, which allows modules to contain classes, interfaces and other modules.
As described in the language reference, its built-in framework supports (Real Software 2011) [4]:
The framework functionality can also be extended by creating plugins using the Plugin SDK provided by Real Software. Plugins are created using C/C++ with a variety of supported compilers, including Xcode, Microsoft Visual Studio and gcc. Plugins can support any platform Realbasic supports, but are not required to support all platforms.[5]
This example writes to a new text file:
Dim t as TextOutputStream Dim f as FolderItem f=GetSaveFolderItem(FileTypes1.Text,"Create Example.txt") If f <> Nil then t=TextOutputStream.Create(f) t.WriteLine(TextField1.text) t.Close End if
This example draws a triangle in a Canvas control. It is placed in the Paint event. The parameter g as Graphics is passed into this event:
Dim Points() as Integer Points=Array(10,10,100,50,10,200,10,10) g.ForeColor=RGB(100,200,255) g.FillPolygon Points
The following code creates an internal database and uses SQLExecute to create a table:
Dim db as REALSQLdatabase Dim f as FolderItem Dim result as Boolean f=New FolderItem("mydb") db=New REALSQLdatabase db.databaseFile=f result=db.CreateDatabaseFile If db.Connect() then db.SQLExecute("create table invoices(id integer,Cust_ID integer,Amount double, Date date)") db.Commit else MsgBox "Database not created" end if