Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?



Class window

Object
   |
   +--window

class window


Extensions to the window object when running widgets

The window around a widget can be controlled in a more detailed way than normal browser windows. This object provides methods for the following features:

  • Moving and resizing the widget.
  • Setting a status message.

Example:

window.resizeTo(300,300);

The following properties and methods were introduced in Opera 9.5. They are not available in 9.2x and below.

All other properties and methods have been available since 9.2x.
Defined in widget-object.js


Field Summary
String defaultStatus
Default status message of this widget.
String status
Status message of this widget.
Constructor Summary
window ()
This class has no public constructor.
Method Summary
void moveBy( <int> delta_x, <int> delta_y )
Move the widget by the given delta.
void moveTo( <int> x, <int> y )
Move the widget to the given coordinates.
void resizeBy( <int> delta_width, <int> delta_height )
Resize the widget by the given delta.
void resizeTo( <int> width, <int> height )
Resize the widget to the given size.
Field Detail

defaultStatus

String defaultStatus
Default status message of this widget.

The default status message is shown in the widget panel in the Opera browser if the window.status is cleared.

Example:

window.status = window.defaultStatus;

status

String status
Status message of this widget.

This status message is displayed in the widget panel in the browser. After a period of inactivity, this message may be cleared automatically. If this property is set to '' or null, it reverts back to the content of window.defaultStatus.

Example:

window.status = numUsers + ' users connected';

Constructor Detail

window

window()
This class has no public constructor.

Method Detail

moveBy

void moveBy( <int> delta_x, <int> delta_y )
Move the widget by the given delta.

Move the widget's left edge delta_x pixels horizontally and the top edge delta_y pixels vertically.

Example:

window.moveBy(200,200);
Parameters:
delta_x - The number of pixels to move left or right.
delta_y - The number of pixels to move up or down.

moveTo

void moveTo( <int> x, <int> y )
Move the widget to the given coordinates.

Move the widget to position x,y.

Example:

window.moveTo(0, 0);
Parameters:
x - Horizontal coordinate to move to.
y - Vertical coordinate to move to.

resizeBy

void resizeBy( <int> delta_width, <int> delta_height )
Resize the widget by the given delta.

Expand or shrink the widget delta_width pixels from the right edge of the widget and delta_height from the bottom edge of the widget. The position of the widget does not change.

Example:

window.resizeBy(250, 100);
Parameters:
delta_width - The number of pixels to increase the width with.
delta_height - The number of pixels to increase the height with.

resizeTo

void resizeTo( <int> width, <int> height )
Resize the widget to the given size.

Resize the widget to be width wide and height high. The position of the widget does not change.

Example:

window.moveTo(0, 0);
window.resizeTo(screen.availWidth, screen.availHeight);
Parameters:
width - Width to resize to.
height - Height to resize to.



Libraries