up: ZWT     index Zimbu documentation

CLASS ZWT.Widget EXTENDS ZWT.UIObject @public

summary

     

A UIObject that handles events and can be added to panels.

Needs to be subclassed to be useful.

NEW() @public 
$getParent() UIObject @public  Return the parent of this Widget.
$ToString() string @public  Returns "Widget". Should be replaced by subclasses.
$getText() string @public  Return the text of the Widget. NIL if there is none.
$setHoverText(text) ZWT.Widget @public  Set the text to be displayed on hover-over.
$getHoverText() string @public  Get the text to be displayed on hover-over.
$addToParent(parent) @public  Add this widget to parent.
$removeFromParent() @public  Remove this Widget from its parent.
$setHandler(eventType, handler) @public  Set handler as the only method to be invoked for eventType.
$addHandler(eventType, handler) @public  Add handler as a method to be invoked for eventType.
$setClickHandler(handler) @public  Set handler as the method to be invoked for a click event on this widget.
$setMouseOverHandler(handler) @public  Set handler as the method to be invoked when the mouse enters the area of this widget.
$setMouseOutHandler(handler) @public  Set handler as the method to be invoked when the mouse leaves the area of this widget.
$setKeyHandler(handler) @public  Set handler to be invoked when a key is typed in this widget.
$setKeyDownHandler(handler) @public  Set handler to be invoked when a key is pressed in this widget.
$setKeyUpHandler(handler) @public  Set handler to be invoked when a key is released in this widget.
$setActive(active) @public  Set whether the Widget handles click events.
$isActive() bool @public  Return whether the Widget was set to be active.
$setInactiveStyle(style) @public  Set the style to be used when the Widget is inactive.
 
Inherited from ZWT.UIObject:
ZWT.Element  $elem @public  The HTML element for this Item.
 
$setStyle(style) @public  Set the main Style for this UIObject to style.
$setStyleList(styles) @public  Set the list of Styles for this UIObject to styles.
$addStyle(style) @public  Add style to this UIObject, keeping previously set ones.
$removeStyle(style) @public  Remove style from this UIObject.
$getStyle() ZWT.Style @public  Return the main Style for this UIObject.
$getStyleList() list<ZWT.Style> @public  Return the list of Styles for this UIObject.
$getWidth() int @public  Return the width of the Element.
$getHeight() int @public  Return the height of the Element.
$getTop() int @public  Return the vertical position of the Element in the page
$getTop(container) int @public  Return the vertical position of the Element within container
$getLeft() int @public  Return the horizontal position of the Element in the page
$getLeft(container) int @public  Return the horizontal position of the Element within container
$setHidden(hidden) @public  Set the item to be hidden or displayed.
 
Known subclasses:
     
 

members (alphabetically)

     

PROC NEW() @default @public

FUNC $ToString() string @default @public

     

Returns "Widget". Should be replaced by subclasses.

PROC $addHandler(ZWT.EventType eventType, proc<ZWT.Event> handler) @public

     

Add handler as a method to be invoked for eventType.

PROC $addToParent(UIObject parent) @default @public

     

Add this widget to parent.

FUNC $getHoverText() string @public

     

Get the text to be displayed on hover-over.

Returns NIL

FUNC $getParent() UIObject @public

     

Return the parent of this Widget.

Returns NIL if there is no parent.

FUNC $getText() string @default @public

     

Return the text of the Widget. NIL if there is none.

FUNC $isActive() bool @public

     

Return whether the Widget was set to be active.

PROC $removeFromParent() @default @public

     

Remove this Widget from its parent.

If there is no parent nothing happens.

PROC $setActive(bool active) @public

     

Set whether the Widget handles click events.

When not active the button is given a style set by $setInactiveStyle() or a grey text by default.

PROC $setClickHandler(proc<ZWT.Event> handler) @public

     

Set handler as the method to be invoked for a click event on this widget.

Any previously set handlers are removed. When handler is NIL there will be no handlers.

PROC $setHandler(ZWT.EventType eventType, proc<ZWT.Event> handler) @public

     

Set handler as the only method to be invoked for eventType.

When handler is NIL all handlers are removed.

FUNC $setHoverText(string text) ZWT.Widget @public

     

Set the text to be displayed on hover-over.

The text is plain text, not HTML. Use NIL or an empty string to clear. Returns the Widget for chaining.

PROC $setInactiveStyle(ZWT.Style style) @public

     

Set the style to be used when the Widget is inactive.

When not set a default grey color is used for the foreground.

Use a NIL style to reset to the default.

PROC $setKeyDownHandler(proc<ZWT.Event> handler) @public

     

Set handler to be invoked when a key is pressed in this widget.

Any previously set handlers are removed. When handler is NIL there will be no handlers.

PROC $setKeyHandler(proc<ZWT.Event> handler) @public

     

Set handler to be invoked when a key is typed in this widget.

Any previously set handlers are removed. When handler is NIL there will be no handlers.

There will also be keyDown and keyUp events. Usually (depending on the browser) the key event is delivered just before the keyUp event.

PROC $setKeyUpHandler(proc<ZWT.Event> handler) @public

     

Set handler to be invoked when a key is released in this widget.

Any previously set handlers are removed. When handler is NIL there will be no handlers.

PROC $setMouseOutHandler(proc<ZWT.Event> handler) @public

     

Set handler as the method to be invoked when the mouse leaves the area of this widget.

Any previously set handlers are removed. When handler is NIL there will be no handlers.

PROC $setMouseOverHandler(proc<ZWT.Event> handler) @public

     

Set handler as the method to be invoked when the mouse enters the area of this widget.

Any previously set handlers are removed. When handler is NIL there will be no handlers.

credits

      The Class hierarchy, generated Javascript and a few other things are based on the Google Web Toolkit. http://code.google.com/webtoolkit/overview.html

license

      Copyright 2009 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0