Introduction

The GUI module ports the widgets of wxWidgets to JavaScript.

wxTheApp

Unlike wxWidgets, there's no application class that derives from wxApp. The wxJavaScript console program instantiates an object of the type wxApp and stores it in the global variable wxTheApp. The application can be initialized assigning a function to the onInit event (Allthough it can also be initialized without this function). This function must create a top-level window and make that window visible. When the return value of this function is false, or there is no top-level window created, or the top-level window is invisible, the main loop will exit immediately. A simple example:

wxTheApp.onInit = init;

function init()
{
 var frame = new wxFrame(null, -1, "A wxApp example");
 // Don't forget to show the frame by setting 
 // the visible property to true!
 frame.visible = true;

 this.topWindow = frame;

 return true;
}

Event Handling

Event handling is simple in JavaScript. The only thing that is needed, is assigning a function to a predefined event property. For example: onKeyDown can be used to react on a pressed key.

text.onKeyDown = function(e)
{
  if (e.keyCode == 13) 
  {
    frame.setStatusText("Enter is not allowed");
    e.skip = false;
  }
}

Removing an event handler, can be done by deleting the event property.

// Delete the event:
delete text.onKeyDown;




SourceForge.net Logo Support This Project

All Classes

Common constants
Global Constants
Global Functions
wxAboutDialogInfo
wxAcceleratorEntry
wxAcceleratorTable
wxActivateEvent
wxAutomationObject
wxBMPHandler
wxBitmap
wxBitmapButton
wxBoxSizer
wxButton
wxCalendarCtrl
wxCalendarDateAttr
wxCalendarEvent
wxCheckBox
wxCheckListBox
wxCheckListBoxItem
wxChoice
wxCloseEvent
wxColourData
wxColourDialog
wxComboBox
wxCommandEvent
wxContextHelp
wxContextHelpButton
wxControl
wxControlItem
wxControlWithItems
wxDialog
wxDirDialog
wxEvent
wxFileDialog
wxFindDialogEvent
wxFindReplaceData
wxFindReplaceDialog
wxFlexGridSizer
wxFocusEvent
wxFont
wxFontData
wxFontDialog
wxFontEnumerator
wxFontList
wxFrame
wxGIFHandler
wxGauge
wxGenericValidator
wxGridSizer
wxHelpEvent
wxHtmlLinkEvent
wxHtmlWindow
wxICOHandler
wxIcon
wxIconizeEvent
wxImage
wxImageHandler
wxImageList
wxInitDialogEvent
wxJPEGHandler
wxKeyEvent
wxListBox
wxListCtrl
wxListEvent
wxListHitTest
wxListItem
wxListItemAttr
wxMDIChildFrame
wxMDIParentFrame
wxMaximizeEvent
wxMenu
wxMenuBar
wxMenuItem
wxMouseEvent
wxMoveEvent
wxNotifyEvent
wxPCXHandler
wxPNGHandler
wxPNMHandler
wxPanel
wxPasswordEntryDialog
wxRadioBox
wxRadioBoxItem
wxRadioButton
wxScrollEvent
wxScrollWinEvent
wxScrolledWindow
wxSizeEvent
wxSizer
wxSlider
wxSpinButton
wxSpinEvent
wxSplitCtrl
wxSplitterEvent
wxSplitterWindow
wxStaticBox
wxStaticBoxSizer
wxStaticText
wxStatusBar
wxSysColourChangedEvent
wxSystemSettings
wxTIFFHandler
wxTextCtrl
wxTextEntryDialog
wxTextValidator
wxToolBar
wxToolBarTool
wxTopLevelWindow
wxTreeCtrl
wxTreeEvent
wxTreeHitTest
wxTreeItem
wxTreeItemId
wxValidator
wxWindow
wxXPMHandler

Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.