YOU ARE VIEWING ARCHIVAL DOCUMENTATION FOR ioL VERSIONS 0.9x. Go to doc.iol.science for the latest version.
ioL

Programming manual (doc0.iol.science)



onresize = ...

This field is provided by the program element and allows you to specify a procedure to handle the event where the ioL console window has been resized by the user or by the operating environment. The program.width and program.height fields contain the current console dimensions in pixels.


An event field like onresize defines a procedure to be run when the event happens.

A procedure in ioL is simply a list of tags and data elements, which are evaluated (in order) to produce some result or behaviour. You can't create markup elements inside the event handling procedure itself, but you can use a push operation inside your procedure to add new markup elements to another location.

Since we didn't get to create this event field ourselves (the program element generates this field automatically when the program starts), we need to use a push operation to add our code handler to it.

Example

This doesn't do what we want:

<program.onresize <putln {An onresize event happened on the program element}>>  <!INCORRECT!>

It doesn't work because of ioL's assignment precedence: ioL first tries to evaluate the putln tag to get a return value out of it, and then tries to assign the result of the evaluation. This means the putln instruction is executed immediately instead of stored in the event handler. It does not return a result, so nothing is stored in the program.onresize field.

Instead, we need to use a push operation. This assigns first and evaluates the code later in the context of the target field, which is what we want:

<program.onresize.clear>  <! Not needed unless we've set other code previously. !>
<program.onresize.push <putln {An onresize event happened on the program element}>>