Samples

The best way to meet wxBasic is to look at some simple lines of code.

To write a simple "Hello, World" on the screen, this is enough:

wxMessageBox("Hello, World")

The samples:

Minimal sample

MinimalEven
a more or less complete Windows application with a frame, menu items and a
status bar is very simple and quick to write.

The "Minimal sample" is taken from the samples of wxWidgets translated to
wxBasic.

The source code

' minimal wxBasic sample
' based on code by Julian Smart
option explicit

' create the main application window
dim frame as wxFrame = new wxFrame( Nothing, wxID_ANY, "Minimal wxBasic App" )

' create a "File" menu and append an item
dim mFile = new wxMenu()
mFile.Append( wxID_EXIT, "E&xit\tAlt-X", "Quit this program" )

' create an "About" menu and append an item
dim mHelp = new wxMenu()
mHelp.Append( wxID_ABOUT, "&About...\tCtrl-A", "Show about dialog" )

' now append the freshly created menu to the menu bar...
dim menuBar = new wxMenuBar()
menuBar.Append(mFile, "&File")
menuBar.Append(mHelp, "&Help")

' ... and attach this menu bar to the frame
frame.SetMenuBar(menuBar)

' create a status bar
frame.CreateStatusBar(2)
frame.SetStatusText("Welcome to wxBasic!")

' callback for the Quit menu option
function OnQuit( event ) handles frame.menuSelected(wxID_EXIT)
    ' TRUE is to force the frame to close
    frame.Close(True)
end function

' callback for the About menu option
function OnAbout( event ) handles frame.menuSelected(wxID_ABOUT)
    dim msg = "This is the \"About\" dialog of the Minimal sample.\n" &
            "Welcome to wxBasic!"
    wxMessageBox( msg, "About Minimal", wxOK + wxICON_INFORMATION, frame )
end function

' frames, unlike simple controls, are not shown when created
frame.Show(True)

 

wxEditor sample (by Dirk Noak)

Minimal

A full featured development environment for wxBasic in Beta stage. Is is based on David Cuny's IDE sample.

Editor sample

MinimalThis
is a new editor that is also based on David Cuny's IDE sample written by Ralf
Peters, that demonstrate some of the new features: wxToolBar, wxArtProvider,
wxLocale, Menu Icons, embedded XPM graphics, ...)

Calculator sample

MinimalThis
is a complete new calculator that demonstrate some of the new features: XRC
support, AcceleratorTable support, ...

Media Player sample

MinimalThis
is a new sample that demonstrate the wxMediaCtrl control.

It was originaly written by John Labenski in wxLua and translated to
wxBasic in a few minutes.

wxAui sample

wxAui

This is also a new sample that demonstrate the use of wxAui classes to manage panes. The screenshot was taken running wxBasic on OSX 10.6