Window

From codeTank

Jump to: navigation, search

Contents

Description

The window table contains all the functions needed to create, control, update, and destroy windows.

A lot of the processing inside a window is done using events. Windows are generally event driven, which means that they sit around and do nothing until something happens. A window object inherits it's event processing from the object table.

You start by creating a window, using window.create. This can be a large call, because window.create has a lot of optional parameters that can be set using a table. window.create will return the window object, which can be stored if needed.

Once a window is created, it will start listening for messages automatically. However, these messages must be converted into events, and pumped to the event handlers. In order to do this, use the function window.pumpmessages. It will look at all windows, see which one has pending messages, and pump the message to the corresponding event handler.

The user can always close a window at any time. In a normal application, you would create one window, and loop in circles, pumping the messages. Once the user closes the window, the script would exit.

Here is a sample bare-bones windows script:

sh: highlight: command not found

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

(error loading support language list)

window.getcount will return the number of windows open. In the example, once there are no windows open (from being closed), then the loop will exit, and the script will finish.

Functions

Events

Depending on the window, it will have different events. To see a list of events that a window listens for, see Window Events.

See Also

Personal tools