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;
  }
}

An event handler gets one argument of type wxEvent. The scope of this argument is restricted to the handler. Outside the handler the argument will always return null when you retrieve properties.

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

Global Constants
Global Functions
wxAboutDialogInfo
wxAcceleratorEntry
wxAcceleratorTable
wxActivateEvent
wxAnimation
wxAnimationCtrl
wxApp
wxAuiManager
wxAuiNotebook
wxAuiNotebookEvent
wxAuiPaneInfo
wxAutomationObject
wxBMPHandler
wxBitmap
wxBitmapButton
wxBookCtrl
wxBookCtrlBase
wxBookCtrlBaseEvent
wxBookCtrlEvent
wxBoxSizer
wxButton
wxCalculateLayoutEvent
wxCalendarCtrl
wxCalendarDateAttr
wxCalendarEvent
wxCaret
wxCheckBox
wxCheckListBox
wxCheckListBoxItem
wxChoice
wxChoicebook
wxChoicebookEvent
wxCloseEvent
wxCollapsiblePane
wxCollapsiblePaneEvent
wxColour
wxColourData
wxColourDialog
wxColourPickerCtrl
wxColourPickerCtrlEvent
wxComboBox
wxCommandEvent
wxContextHelp
wxContextHelpButton
wxControl
wxControlItem
wxControlWithItems
wxCursor
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
wxLayoutAlgorithm
wxListBox
wxListCtrl
wxListEvent
wxListItem
wxListItemAttr
wxListbook
wxListbookEvent
wxMDIChildFrame
wxMDIParentFrame
wxMaximizeEvent
wxMenu
wxMenuBar
wxMenuItem
wxMouseEvent
wxMoveEvent
wxNoteBook
wxNotebookEvent
wxNotifyEvent
wxPCXHandler
wxPNGHandler
wxPNMHandler
wxPanel
wxPasswordEntryDialog
wxPickerBase
wxPoint
wxQueryLayoutInfoEvent
wxRadioBox
wxRadioBoxItem
wxRadioButton
wxRect
wxSashEvent
wxSashLayoutWindow
wxSashWindow
wxScrollEvent
wxScrollWinEvent
wxScrolledWindow
wxSize
wxSizeEvent
wxSizer
wxSizerFlags
wxSizerItem
wxSlider
wxSpinButton
wxSpinEvent
wxSplitCtrl
wxSplitterEvent
wxSplitterWindow
wxStaticBox
wxStaticBoxSizer
wxStaticText
wxStatusBar
wxSysColourChangedEvent
wxSystemSettings
wxTIFFHandler
wxTextCtrl
wxTextEntryDialog
wxTextValidator
wxToolBar
wxToolBarTool
wxToolbook
wxToolbookEvent
wxTopLevelWindow
wxTreeCtrl
wxTreeEvent
wxTreeItem
wxTreeItemId
wxTreebook
wxTreebookEvent
wxValidator
wxWindow
wxXPMHandler

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