WxBasic

de:wxBasic wxBasic is an open source, cross-platform BASIC interpreter. As it is based on the easy-to-use syntax of the BASIC language, it is simple to learn and understand, allowing even novice programmers to write nice-looking applications for graphical environments like Windows and Linux with minimal effort. As of September, 2004, the software is in a beta state, but it is effective enough for hobby programming.

It can create stand-alone executables by binding together source code with the interpreter. In contrast with executables created by similar commercial programs like Visual Basic, executables produces by wxBasic do not require any external DLL file, resource file, or installer to run. The executable is distributed alone and can be run immediately by end users. As with programs written in any interpreted language, wxBasic programs may also be run straight from the source code if wxBasic is present on the system, regardless of which system they were written on. This saves download time, as generated executables tend to be several orders of magnitude greater than the source code from which they were compiled.

wxBasic is written primarily in C, with some C++ linking it to the wxWidgets library. wxWidgets supplies the cross-platform features, making wxBasic a very powerful, although beginner-friendly, programming language.

wxBasic runs on Windows using native controls, and Linux using the GTK Library. A Macintosh port is being actively investigated.

wxBasic is a bytecode based language, like Perl or Java.

Comprehensive example

To give an idea how the syntax looks like see the following program which implements a text viewer:


 ' from http://wxbasic.sourceforge.net/phpBB2/viewtopic.php?t=554
 ' Simple Text Viewer written in wxBasic
 dim AppName = "Text Viewer"
 fileName = "" 
 ' Main window
 dim frame = new wxFrame( Nothing, -1, AppName & " - Untitled Document" )
 ' Text edit control
 dim control = new wxTextCtrl( frame, -1, "", wxPoint( 0, 0 ),
 wxSize( 100, 100 ), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH)
 ' Status bar - The one at the bottom of the window
 dim status = frame.CreateStatusBar( 1 )
 frame.SetStatusText("Ready")
 '
 ' Dialog used for Open
 dim fileDialog = new wxFileDialog( frame )
 '
 ' add menubar to the frame
 dim mBar = new wxMenuBar()
 frame.SetMenuBar(mBar)
 '
 ' build the "File" dropdown menu
 dim mFile = new wxMenu()
 mBar.Append(mFile, "&File")
 
 ' make it
 '
 mFile.Append( wxID_OPEN, "&Open...", "Loads an existing file from disk" )
 '
 mFile.AppendSeparator()
 mFile.Append( wxID_EXIT, "E&xit\tAlt-X", "Exit Application" )
 Sub onFileOpen( event )
    fileDialog.SetMessage("Open File")
    fileDialog.SetStyle( wxOPEN )
    If fileDialog.ShowModal() = wxID_OK Then
      fileName = fileDialog.GetPath()
      Ext = fileDialog.GetFilename()
      control.Clear()
      control.LoadFile( fileName )
      frame.SetTitle( AppName & " - " & fileName )
      frame.SetStatusText(Ext)
   End If
 End Sub
 '
 Connect( frame, wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, "onFileOpen" )


 Sub onFileExit( event )
   frame.Close(True)
 End Sub
 '
 Connect( frame, wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, "onFileExit" )
 ' build the "Help" dropdown menu
 dim mHelp = new wxMenu()
 mBar.Append(mHelp, "&Help")
 mHelp.Append( wxID_HELP, "&About\tF1", "About this program" )
 '
 Sub onHelpAbout( event )
   Dim msg = "Text View allows any text file\n" &
   "to be viewed reguardless of its extension.\n" &
   "If the file being opened isn't a text file\n" &
   "then it won't be displayed. There will be a\n" &
   "little garbage shown and that's all."
   wxMessageBox( msg, "About Text View", wxOK + wxICON_INFORMATION, frame )
 End Sub
 Connect( frame, wxID_HELP, wxEVT_COMMAND_MENU_SELECTED, "onHelpAbout" )
 frame.Show(True)

External links

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools