on.resize

From Inspired-Lua Wiki
Revision as of 22:09, 3 September 2011 by Adriweb (talk | contribs)
Jump to navigation Jump to search

The event on.resize is fired when the user resizes the window where the lua script is.

It has no argument.

It's a good place to put your global window-size-related variable since this event only fires when the script's frame's size changes (see Example).

Example

Below is an example of a program that draws a line on the screen when the user resizes the window :

function on.resize() --Define a function for the event
    theWidth = platform.window.width()
    theHeight = platform.window.height()
end

You can then refer to the height and the width of the widget by calling the global variables instead of the Catrgory:platform.window methods.