A dialog or an HTML frame can use boxed objects to arrange the contents using absolute positioning.
A boxed object is an HTML element that can participate in automatic dialog/frame layout made by @lib:Global!LAYOUT_BOX method Having a hierarchy of boxed objects allows to arrange the dialog/frame contents automatically by a single call to 'layout' method (e.g. by invoking @lib:Dialog!layout method).
Typically, the layout is done during HTML initializaiton or on ~body resize by calling to ~layout method of the tompost boxed object. The simplest method to achieve proper size calculation is to use @lib:Dialog! component, as the topmost element in the page. The Dialog component automatically takes entire document client area, listens on window intialization and resizing events and arranges all elements in the document automatically. If you need to resize some boxed object at later time, use @lib:Global!SET_BOX (do not setting the ~box attribute dynamically).
The following shows a skeleton of a typical HTML page with boxed objects and automatic layout calculation:
There are several types of boxed objects:
Note: IFRAME cannot be boxed object. To achieve proper positioning of IFRAME, the hosting dialog/frame must manually adjust IFRAME's position (via standard HTML style attributes). Typically, this is done during host dialog/frame initialization and on each resize.
In order to allow recursive layout calculation to go over the entire boxed objects hierarchy without stopping at any level, it is important to define each boxed object correctly, depending on boxed object type:
A simple HTML element.
<PUBLIC:PROPERTY name="hasChildBoxes" value="yes" />
<PUBLIC:PROPERTY name="box" get="getBox" put="setBox" />
Implement the following public HTC property (see also @lib:Box!box):
<PUBLIC:PROPERTY name="hasOwnLayout" value="yes" />
Implement the following public HTC method (see @lib:Box!layout):
<PUBLIC:METHOD name="layout" />
Additional guidelines regarding heavyweight HTC components
The following shows a skeleton of a typical heavyweight HTC which is a boxed object:
If one heavyweight HTC is used by another heavyweight HTC, then the automatic layout, invoked by tompost Dialog element during HTML initialization, might not work, because innermost HTC was not yet loaded (heavyweight HTC are loaded asynchronously). In such case, you need to attach the outermost HTC to the ~ondocumentready event (~ondocumentready is fired from bottom to top, so that parent element is only ready when all child elements are ready).
The following shows typical heavyweight HTC which includes another heavyweight HTC: