Resizing and Layouts
Involved Mixins
Your widget will have to have dijit._Contained mixed in, and dijit._Container if you plan to put other widgets inside of it. Being a container means that the getChildren function will be available to you for use when passing down the resize events.
How Layout Widgets Communicate
A container will call the resize function on its contained widgets (that should also be its direct children to avoid ambiguous layout). They might pass a size object, and the conditions in which they will are outlined below.
2 Modes of Positioning
In many browsers, an easy method of making a block node fill up the entire area of its parent container (parent container referring to any node positioned using the relative or absolution value) is to position it absolutely, and set its top, right, bottom, and left positions to 0. This isn't true for all browsers or all nodes. Because of this, it can be confusing knowing how your resize function should work.
The resize Function
If you receive a size object (which has t, l, w, and h properties representing top, left, width, and height) then it probably means that your layout has encountered a situation in which CSS is no longer capable of handling positioning. What this means is that you'll have to alter this object according to the unique properties (most likely padding and offsets) before passing the value to contained widgets. You'll also use this object to size the widget's node using either dojo.marginBox as a setter, or setting the style properties directly.
If you don't receive a size object, it probably means that you can make adjustments using only CSS. For example, if you change the style attribute top in this situation, the height automatically changes, while in non-CSS mode, you would probably end up pushing your node down, without its height changing.
- Printer-friendly version
- Login or register to post comments
- Unsubscribe post
