[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 4.19.3 Widget object

The Widget object is the base for any widget that will be displayed on the screen, or used as a container for other displayable widgets. It has a number of methods and properties, and is very likely the most complex object in the system.

Widgets that are not children, and that are not docked are top-level widgets. This means that they exist in a linked list that indicates their drawing level. Currently AWS2 uses a focus-follows-mouse for widget activation/deactivation.

The following table summarizes all of the methods that are available for a widget.

`Move(x,y)`

  Move the widget relative to x,y.

`MoveTo(x,y)`

  Move the widget to absolute position x,y.

`Resize(width,height)`

  Resize the widget relative to width,height.

`ResizeTo(width,height)`

  Resize the widget to absolute size width,height.

`Invalidate()`

  Indicates the the state of this widget has changed, and on the next redraw it's `onRedraw` function will be called.

`GetPen()`

  Gets the Pen object, if any, associated with this widget.

`SetPen(pen)`

  Sets the Pen object to be associated with this widget.

`AddChild(child, ...additional parms...)`

  Adds a widget as a child to this widget. If any additional parameters are specified, they will be passed to the onAddChild event that gets fired before this method completes.

`RemoveChild(child, ...additional parms...)`

  Removes a widget as a child to this widget. If any additional parameters are specified, they will be passed to the onRemoveChild event that gets fired before this method completes.

`Dock(sibling, position)`

  Docks a widget to the given position. The position may be one of the DOCK_XXXX properties listed below. Only one widget should be docked to any given position. The sibling widget's frame will be resized and/or moved in accordance with the frame that is being docked to. Docking occurs in peer relationships, not parent/child.

`Broadcast(signal_name)`

  This essential calls the function named by signal_name on all of the children of the given widget. It does not propagate to grandchildren and below.

`SetFrameAnchor(anchor_flags)`

  When a child widget sets this flag to any of the STICK_XXXX flags, the frame of the child will be resized and/or moved relative to the frame of the parent. You may bitwise-or the flags together to specify more than one.

`ClearFrameAnchor(anchor_flags)`

  Clears the given STICK_XXXX flags. You may bitwise-or the flags together to specify more than one.

`SetMargin(size, where)`

  Creates a spacer, or margin, for docked or anchored widgets. `size` pixels will be inserted between the borders of the two widgets on the side indicated by `where`.

`CaptureMouse()`

  Indicates that this widget wants all mouse events to come to it, irregardless of whether the mouse is over the widget or not. This is useful for dragging pieces of a widget around (like the slider and scrollbars knobs).

`ReleaseMouse()`

  If the mouse has been captured, release it.

`Show()`

  If a widget is invisible, make it visible.

`Hide`

  If a widget is visible, make it invisible.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.