1. A very basic app
An example app which demonstrates the creation of a window with simple contents inside
This API example will show you how to create a very basic app with a resizable window. You may use it as a base for new apps, since it will just be an empty window.
Creating the file
This example will take place at c:/system/boot/apps/example_1.js
.
Defining the goal
The goal of this application is to be used as a base for writing new applications to save time.
The source code
// Import the necessary functions from their namespaces.
const { register } = w96.app;
const { Theme } = w96.ui;
// Define the application class
class ExampleApplication extends WApplication {
constructor() {
super();
}
async main(argv) {
super.main(argv);
// Create the main window object and assign it to a variable
const mainwnd = this.createWindow({
title: "My Application",
icon: Theme.getIconUrl("exec", "small"), // The icon for this window.
initialHeight: 400,
initialWidth: 640,
body: "very cool text", // Specify the HTML body of your application here.
bodyClass: "example1-app", // The class to use to style the body and its contents of this window.
taskbar: true // Show this window in the taskbar
}, true); // true specifies that this is an app window (main window)
mainwnd.show();
}
}
// Register the app
register({
command: "example-app",
type: "gui",
cls: ExampleApplication,
meta: {
icon: Theme.getIconUrl("exec"), // You may specify a custom icon URL here.
friendlyName: "Example Application"
}
});
The final result

Important notes
Note that this app uses this.createWindow
instead of StandardWindow
to create windows. This is done because WApplication
will automatically manage the creating of windows and sub-windows when the application is started.
Last updated
Was this helpful?