Incremental layouts
Factor handbook » UI framework » Building user interfaces » Gadget hierarchy and layouts

Prev:Manual layouts
Next:Implementing layout gadgets

Incremental layout gadgets are like Pack layouts except the relayout operation after adding a new child can be done in constant time.

With all layouts, relayout requests from consecutive additions and removals are of children are coalesced and result in only one relayout operation being performed, however the run time of the relayout operation itself depends on the number of children.

Incremental layout is used by Pane gadgets to ensure that new lines of output does not take longer to display when the pane already has previous output.

Incremental layouts are not a general replacement for Pack layouts and there are some limitations to be aware of.

<incremental> ( -- incremental )

Children are added and removed with a special set of words which perform necessary relayout immediately:
add-incremental ( gadget incremental -- )

clear-incremental ( incremental -- )

Calling unparent to remove a child of an incremental layout is permitted, however the relayout following the removal will not be performed in constant time, because all gadgets following the removed gadget need to be moved.