up: ZUT     index Zimbu documentation

CLASS ZUT.Element @public

summary

     

A wrapper around an HTML element.

Only to be used in Javascript code.

ZUT.DomElement  $el @file 
 
NEW(el) @file 
$getParent() ZUT.Element @public  Get the parent Element
$getChildren() list<ZUT.Element> @public  Get the list of child Elements.
$getValue() string @public  Get the value of the DOM element.
$setValue(text) @public  Set the value of the DOM element.
$getText() string @public  Get the text content of the DOM element.
$setText(text) @public  Set the text content of the DOM element.
$getAttribute(name) string @public  Return the attribute value of the DOM element.
$getClasses() string @public  Return the class attribute value of the DOM element.
$setClasses(classes) @public  Sets the class attribute value of the DOM element to classes.
$hasClass(class) bool @public  Returns TRUE if the class property of the Element contains class.
$addClass(class) @public  Add class to the class property, if it wasn't there yet.
$removeClass(class) @public  Remove class from the class property, if it wa there.
$setDisplay(display) @public  Set the display attribute.
$setDisabled(disabled) @public  Set the disabled attribute of a button.
$setStyle(name, value) @public  Set style attribute name to string value.
$setStyle(name, value) @public  Set style attribute name to number value.
$setBackgroundColor(r, g, b) @public  Set the background-color style attribute to the r, g and b values.
$getWidth() int @public  Return the width of this Element.
$getHeight() int @public  Return the height of this Element.
$getTop() int @public  Return the vertical position of this Element in the page
$getTop(container) int @public  Return the vertical position of this Element within container
$getLeft() int @public  Return the horizontal position of this Element in the page
$getLeft(container) int @public  Return the horizontal position of this Element within container
$getHorizontalScroll() int @public  Get the current horizontal scroll position in pixels.
$setHorizontalScroll(pixels) @public  Set the horizontal scroll position to pixels.
$scrollLeft() @public  Scroll horizontally to the far left.
$scrollRight() @public  Scroll horizontally to the far right.
$getVerticalScroll() int @public  Get the current vertical scroll position in pixels.
$setVerticalScroll(pixels) @public  Set the vertical scroll position to pixels.
$scrollTop() @public  Scroll vertically to the top.
$scrollBottom() @public  Scroll vertically to the bottom.
$ensureVisible(element) @public  Ensure that element is visible by scrolling horizontally and/or vertically.
$ensureVisibleVertical(element) @public  Ensure that element is visible by scrolling vertically only.
$ensureVisibleHorizontal(element) @public  Ensure that element is visible by scrolling horizontally only.
$fireEvent(type, key) @public  Fire an event on the element.
$addListener(listener) @file  Add a listener to the Element.
$hasListener() bool @file  Return TRUE if this element has any listeners.
$triggerListeners(info) @file  Trigger all listeners, passing info.
$fill(template) @public  Fill the element with the result of template.
$removeFromDom() @public  Remove this element from the DOM.
 

members (alphabetically)

     

ZUT.DomElement $el @file

PROC NEW(ZUT.DomElement el) @file

PROC $addClass(string class) @public

     

Add class to the class property, if it wasn't there yet.

Can only be used in the client.

PROC $addListener(ZUT.I_Listener listener) @file

     

Add a listener to the Element.

Can only be used in the client.

PROC $ensureVisible(ZUT.Element element) @public

     

Ensure that element is visible by scrolling horizontally and/or vertically.

If possible, element is centered in the viewable space.

element must be a child if this element.

Can only be used in the client.

PROC $ensureVisibleHorizontal(ZUT.Element element) @public

     

Ensure that element is visible by scrolling horizontally only.

If possible, element is centered in the viewable space horizontally.

element must be a child if this element.

Can only be used in the client.

PROC $ensureVisibleVertical(ZUT.Element element) @public

     

Ensure that element is visible by scrolling vertically only.

If possible, element is centered in the viewable space vertically.

element must be a child if this element.

Can only be used in the client.

PROC $fill(ZUT.HtmlFunc template) @public

     

Fill the element with the result of template.

Can only be used in the client.

PROC $fireEvent(ZUT.EventType type, int key) @public

     

Fire an event on the element.

Can only be used in the client.

FUNC $getAttribute(string name) string @public

     

Return the attribute value of the DOM element.

Returns an empty string when the attribute does not exist.

Can only be used in the client.

FUNC $getChildren() list<ZUT.Element> @public

     

Get the list of child Elements.

Returns an empty list if there are no children.

FUNC $getClasses() string @public

     

Return the class attribute value of the DOM element.

Returns an empty string when the attribute does not exist.

Can only be used in the client.

FUNC $getHeight() int @default @public

     

Return the height of this Element.

Only works when it is visible.

FUNC $getHorizontalScroll() int @public

     

Get the current horizontal scroll position in pixels.

Zero means that the left side is visible.

FUNC $getLeft() int @public

     

Return the horizontal position of this Element in the page

FUNC $getLeft(ZUT.Element container) int @public

     

Return the horizontal position of this Element within container

If the Element is not inside container return -1. If container is NIL this works like getLeft().

FUNC $getParent() ZUT.Element @public

     

Get the parent Element

Returns NIL for the HTML element.

FUNC $getText() string @public

     

Get the text content of the DOM element.

FUNC $getTop() int @public

     

Return the vertical position of this Element in the page

FUNC $getTop(ZUT.Element container) int @public

     

Return the vertical position of this Element within container

If the Element is not inside container return -1. If container is NIL this works like getTop().

FUNC $getValue() string @public

     

Get the value of the DOM element.

FUNC $getVerticalScroll() int @public

     

Get the current vertical scroll position in pixels.

Zero means the top is visible.

Can only be used in the client.

FUNC $getWidth() int @default @public

     

Return the width of this Element.

Only works when it is visible.

FUNC $hasClass(string class) bool @public

     

Returns TRUE if the class property of the Element contains class.

Can only be used in the client.

FUNC $hasListener() bool @file

     

Return TRUE if this element has any listeners.

Can only be used in the client.

PROC $removeClass(string class) @public

     

Remove class from the class property, if it wa there.

Can only be used in the client.

PROC $removeFromDom() @public

     

Remove this element from the DOM.

Can only be used in the client.

PROC $scrollBottom() @public

     

Scroll vertically to the bottom.

Can only be used in the client.

PROC $scrollLeft() @public

     

Scroll horizontally to the far left.

PROC $scrollRight() @public

     

Scroll horizontally to the far right.

PROC $scrollTop() @public

     

Scroll vertically to the top.

Can only be used in the client.

PROC $setBackgroundColor(int r, int g, int b) @public

     

Set the background-color style attribute to the r, g and b values.

Can only be used in the client.

PROC $setClasses(string classes) @public

     

Sets the class attribute value of the DOM element to classes.

classes must be a space saparated list of class names.

Can only be used in the client.

PROC $setDisabled(bool disabled) @public

     

Set the disabled attribute of a button.

When disabled is TRUE then the button will be disabled. When disabled is FALSE then the button will be enabled.

Can only be used in the client.

PROC $setDisplay(bool display) @public

     

Set the display attribute.

When display is TRUE then style.display is made empty. When display is FALSE then style.display is set to "none".

Can only be used in the client.

PROC $setHorizontalScroll(int pixels) @public

     

Set the horizontal scroll position to pixels.

Use zero to scroll to the far left.

Can only be used in the client.

PROC $setStyle(string name, string value) @public

     

Set style attribute name to string value.

Can only be used in the client.

PROC $setStyle(string name, int value) @public

     

Set style attribute name to number value.

Can only be used in the client.

PROC $setText(string text) @public

     

Set the text content of the DOM element.

PROC $setValue(string text) @public

     

Set the value of the DOM element.

PROC $setVerticalScroll(int pixels) @public

     

Set the vertical scroll position to pixels.

Use zero to scroll to the top.

Can only be used in the client.

PROC $triggerListeners(dyn info) @file

     

Trigger all listeners, passing info.

Can only be used in the client.

license

      Copyright 2014 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