Jump to content

Realbasic

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Sun Creator (talk | contribs) at 21:33, 8 August 2012 (Example code: Typo fixing and checking using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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]

Language features

Realbasic is a strongly typed, case-insensitive 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.

Framework features

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]

Example code

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{{Not a typo|.}}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

See also

Comparable Basic Dialects

Other Programming Languages

References

  1. ^ Barr, Joe (August 4, 2005). "Review: RealBasic 2005 for Linux". Linux.com. Retrieved 2006-04-11.
  2. ^ Smith, Tony (September 13, 2005). "RealBasic 2005 for Mac, Windows and Linux". The Register. Retrieved 2006-04-11.
  3. ^ Ohlhorst, Frank (June 2011). "3 Tools to Accelerate Web Development". IDG. Retrieved 2011-06-17.
  4. ^ Real Software (May 6, 2008). "Real Studio Language Reference". Real Software. Retrieved 2011-11-30.
  5. ^ Tejkowski, Erick (2001). REALbasic for Dummies. Hungry Minds. ISBN 0-7645-0793-1.