Client Class wwControl

The wwControl class is a thin wrapper around HTML DOM controls that provides browser independent functionality for a handful of common behaviors and operations as well as some useful and frequently resusable visual effects. There are two ways you can get a reference to a wwControl from a DOM element:

var ctl = new wwControl("divElement"); var ctl2 = $ww("divElement");

The easiest to create a wwControl object is to pass it a Client Control Id as a string:

var Ctl = new $ww("Panel") ; if (Ctl.isNull) return; Ctl.setHtml("<b>Hello World<b>"); Ctl.setText("This string contains a <div> tag as text."); Ctl.setOpacity(.85); Ctl.showShadow(.20,7); Ctl.centerInClient(); Ctl.css("Color","green"); // same as Ctl.element.style = "green"; var domElement = Ctl.element;

To create the control you can also pass in an existing DOM reference:

var divPanel = $('Panel'); var Ctl = new wwControl(divPanel);


Remarks

This class has no dependencies on server side features.

Class Members

MemberDescription
centerInClient Centers the control in the client area of the browser.
o.wwControl.centerInClient()
css Sets a CSS style using DOM style element notation for CSS property names. This is the same as referencing ctl.element.style.cssProperty and assiging a value to it. This shortcut is provided to reduce code size.
o.wwControl.css(style,value)
fadein Fades in the specified control by using Opacity.
o.wwControl.Fadein(Step,Percent,FinalPercent)
fadeout Fades out the control content by using opacity.
o.wwControl.fadeout(HideOnZero,Step,StartPercent,UseVisibility)
getBounds Returns and object that returns x, y, width, height properties that contains the bounds of the object for the absolute position of the control. The optional parameter allows returning a client window relative position that is adjusted for scrollbars.
o.wwControl.getBounds(GetAbsolute)
getLocation Returns an object with x and y properties that returns the absolute document position of the control. Optional parameter allows returning client coordinates adjusted for scroll position.
o.wwControl.getLocation(NoContainerSearch)
hide Hides a control by setting its display or visibility attributes.
o.wwControl.hide(KeepPlaceHolder)
hideShadow Hides a shadow that was previously shown on the control.
o.wwControl.hideShadow()
setBounds Sets the bounds of the current control.
o.wwControl.setBounds(x,y,width,height)
setHtml Assigns HTML to the control. Currently simply set the innerHTML if avalailable.
o.wwControl.setHtml(HtmlText)
setLocation Sets the absolute position of a control.
o.wwControl.setLocation(x,y,AddScroll)
setOpactity Sets the opacity of the control to the specified value. The value is specifed as a fractional percentage (ie. 0.23 for 23%).
o.wwControl.setOpactity(Percent)
setText Sets text on the control. If the control has a value property the value is set, otherwise the innerText or textContent property is set. Text set will be HTML encoded by the browser automatically. If you need to encode on your own or provide custom formatting use setHtml instead.
o.wwControl.setText
show Makes the control visible by setting the display and visibility attributes. If SetOpacity is passed opacity is also set to 1.
o.wwControl.show(SetOpacity)
showShadow Displays a shadow on the control. The control must be absolutely positioned.
o.wwControl.showShadow(Opacity,Offset,DelayShadow)
element A reference to the underlying HTML DOM element that the wwControl object is bound to. The element is passed as part of the constructor either as a string which is retrieved and stored or as an existing DOM object reference
id The id of the underlying control. Same as Ctl.control.id. Provided for convenience.
isNull Can be checked whether the control is properly initialized. Due to the fact that constructors will create an object even if you fail, this property can be used to determine if the control assigned to the wwControl instance was properly initialized.

Requirements

See also:

Class wwControl

  Last Updated: 10/9/2007 | © West Wind Technologies, 2008