The Brick Object

Brick object is based on HTML Div element.

Example

var brkSample = new TBrick();
var wndBrickSample = createWindow('Brick Sample');

brkSample.setSize(200, 200);
brkSample.setBackground('#e5eecc');
brkSample.setBorder('#000000', 1, 1, 1, 1);

wndBrickSample.add(brkSample);
showModal(wndBrickSample);

Brick constructor takes two optional parameters:

var brkSample = new TBrick(cssClass, parentObject);

Brick Methods and Properties
Method/Property Description
addEvent Attaches an event to the brick object:
addEvent(eventName, eventHandler)
alignLeft Positions brick object to the left. By default brick object has center align
alignRight Positions brick object to the right. By default brick object has center align
appendChild Appends a child object to the brick element: appendChild(child)
destroy Works as destructor for brick object
disable Disables brick object
enable Enables brick object
getElement Gets the base html div element
getX Gets X coordinate (left) of the brick object
getY Gets Y coordinate (top) of the brick object
justifyText Justifies text inside the brick object: justifyText()
removeChild Removes child element from the brick object: removeChild(child)
removeEvent Detaches event from the brick object. Form:
removeEvent(eventName, eventHandler)
setBackground Sets brick object background. Example:
brk.setBackground('#FFFFFF');
setBackgroundImage Sets brick object background image. Example: brk.setBackgroundImage('images/sample.png');
setBackgroundPosition Sets the starting position of the brick object background image. Example: brk.setBackgroundPosition('center');
setBackgroundSize Sets the size of the brick object background image. Example: brk.setBackgroundSize('cover');
setBorder Sets border of the brick object. Form: setBorder(borderColor, leftBorder, rightBorder, topBorder, bottomBorder, roundedCorners)
Example: brk.setBorder('#000000', 1, 1, 1, 1, 1);
setBorderBottom Sets the bottom border of the brick object. Example: brk.setBorderBottom(1);
setBorderLeft Sets the left border of the brick object. Example: brk.setBorderLeft(1);
setBorderRight Sets the right border of the brick object. Example:
brk.setBorderRight(1);
setBorderTop Sets the top border of the brick object. Example: brk.setBorderTop(1);
setCursor Sets the cursor style on the brick object. Example:
brk.setCursor('pointer');
setDirection Sets the direction of the brick object (default value is ltr). Example: brk.setDirection('rtl');
setFilter Sets the transparency of the brick object background. Example: brk.setFilter(30);
setFocus Sets focus on the brick object. Example: brk.setFocus();
setFontSize Sets font size inside the brick object. Example: brk.setFontSize(14);
setHeight Sets the height (in pixels) of the brick object. Example:
brk.setHeight(200);
setOverflow Sets the overflow of the brick object. Example:
brk.setOverflow('scroll');
setOverflowX Sets the horizontal overflow of the brick object. Example: brk.setOverflowX('hidden');
setOverflowY Sets the vertical overflow of the brick object. Example: brk.setOverflowY('scroll');
setPadding Sets the padding of the brick object. Example: brk.setPadding(10);
setSize Sets the size (in pixels) of the brick object. Form: setSize(width, height)
Example: brk.setSize(200, 200);
setTabIndex Sets the tab index of the brick object. Example: brk.setTabIndex(10);
setText Sets the inner html of the brick object. Example:
brk.setText('Test Brick');
setTooltip Sets a tooltip for the brick object. Example:
brk.setTooltip('Test Brick');
setWidth Sets the width (in pixels) of the brick object. Example:
brk.setWidth(200);
setX Sets the x coordinate of the brick object. Example: brk.setX(500);
setY Sets the y coordinate of the brick object. Example: brk.setY(500);