diff -r 913c9751c067 -r 716254ccbcc0 org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-0FCBC574-2328-4986-99D3-7DC4BDE9C3A4.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-0FCBC574-2328-4986-99D3-7DC4BDE9C3A4.html Fri Mar 05 19:11:15 2010 -0800 @@ -0,0 +1,26 @@ + + +STEW: loading the widget at startup

STEW: loading the widget at startup

This section describes how to load a widget at startup.

+

The init function in the main.js file loads the widget. The function is triggered by the init event of the widget body element. The following code illustrates how to assign a function to the onload event handler, <body onload="javascript:init();">:

+
<body onload="javascript:init();">
+
+function init() {
+	// Disable cursor mode.	
+	widget.setNavigationEnabled( false );
+	
+	// Create the views.
+	widgetMenu = new Menu();
+	loginScreen = new LoginScreen();
+	updateScreen = new UpdateScreen();
+	searchScreen = new SearchScreen();
+	settingsScreen = new SettingsScreen();
+	
+	// Show first view.
+	widgetMenu.activate( Menu.LOGIN_SCREEN );
+}
+
+

The above code creates all the widget views and activates the Login view screen by calling the activate function assigned to the menu option.

+
\ No newline at end of file