Template:Short description Template:Primary sources Template:Lowercase {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other wxBasic is a free software / open-source software, cross-platform BASIC interpreter. As it is based on syntax of the BASIC language, it is designed to be simple to learn and understand, and allow novice programmers to write applications for graphical environments like Windows and Linux with minimal effort. wxBasic is a bytecode based language, like Perl or Java. It is licensed under the LGPL, so proprietary software's source code can be linked against it.

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 produced 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 on any platform, if wxBasic is present.

wxBasic is written primarily in C, with some C++ linking it to the wxWidgets library. wxWidgets supplies the cross-platform features. It runs on Microsoft Windows using native controls, and on Linux and macOS using the GTK+ library.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> wxBasic is also the basis for the SdlBasic project.

ExampleEdit

The following program implements a text viewer:

<syntaxhighlight lang="vbscript">

 ' 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 regardless 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)

</syntaxhighlight>

ReferencesEdit

Template:Reflist

External linksEdit

Template:Portal

Template:BASIC Template:WxWidgets