wxBasic
Appearance
Developer(s) | David Cuny |
---|---|
Initial release | 2002 |
Stable release | |
Cross-platform | |
License | GNU Lesser General Public License |
Website | wxbasic |
wxBasic is a
LGPL, so proprietary software
's source code can be linked against it.
It can create stand-alone
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
project.Example
The following program 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 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)
References
- ^ a b "News, November 2016". wxbasic.net. Retrieved 25 September 2017.
- ^ "Download". wxbasic.net. Retrieved 25 September 2017.