Difference between revisions of "Using Automatic Placement"

From HLKitWiki
Jump to: navigation, search
Line 6: Line 6:
 
Automatic placement can only be used on visual elements within layouts, panels, and sheets. Every one of these element types manages internal logic to support automatic placement, so you can use the mechanism whenever it suits your needs. Automatic placement assumes that you are placing a progression of visual elements in a vertical arrangement, with each successive element appearing beneath the previous element.
 
Automatic placement can only be used on visual elements within layouts, panels, and sheets. Every one of these element types manages internal logic to support automatic placement, so you can use the mechanism whenever it suits your needs. Automatic placement assumes that you are placing a progression of visual elements in a vertical arrangement, with each successive element appearing beneath the previous element.
  
-Visual elements can utilize the "autoplace" target reference for quick and easy
+
All placement is performed within a rectangular region. Before anything is placed, the bounds of this region are initialized to be the full height and width of the visual container (i.e. the layout, panel, or sheet). When placement begins, each new placement consumes vertical space within the region. This automatically shrinks the region, moving the top of the region downward to the bottom of each new visual element that is placed.
    placement of those elements
+
 
    -Syntax is "autoplace[gap]", where "gap" is the vertical gap between the new
+
Automatic placement is performed via the "autoplace" target reference. Each placement can specify a gap that should appear between the new element and the one previously placed.
        element being placed and the bottom of the previous element that was
+
 
        automatically placed
+
 
 +
 
 +
 
 
     -Additional target references provide an author with complete control over
 
     -Additional target references provide an author with complete control over
 
         the bounds of the region within which automatic placement is performed
 
         the bounds of the region within which automatic placement is performed
Line 22: Line 24:
 
         -"autowidth" and "autoheight" provide read/write access to the dimensions
 
         -"autowidth" and "autoheight" provide read/write access to the dimensions
 
             -They default to the full width of the visual container
 
             -They default to the full width of the visual container
    -Before anything is placed, the bounds of the region are initialized to be
 
        the full height and width of the visual container (i.e. layout or scene)
 
 
     -When an element is automatically placed, the width of that element is set
 
     -When an element is automatically placed, the width of that element is set
 
         to the "autowidth" of the visual container
 
         to the "autowidth" of the visual container
    -After an element is automatically placed, the "top" edge of the region is
 
        moved downward to the bottom of the placed visual element
 
 
     -When a template is automatically placed, it is rendered upon completion
 
     -When a template is automatically placed, it is rendered upon completion
 
     -When a layout is automatically placed, it is estimated upon completion
 
     -When a layout is automatically placed, it is estimated upon completion

Revision as of 05:20, 20 November 2008

[Context: HL KitBasic Concepts and TerminologyManipulation of Visual Elements]

In an effort to make things as easy as possible, the Kit provides a mechanism called "automatic placement" that makes positioning certain visual elements significantly easier. Although primarily intended for use within sheets, automatic placement can also be used in various places with on-screen visual elements.

Automatic placement can only be used on visual elements within layouts, panels, and sheets. Every one of these element types manages internal logic to support automatic placement, so you can use the mechanism whenever it suits your needs. Automatic placement assumes that you are placing a progression of visual elements in a vertical arrangement, with each successive element appearing beneath the previous element.

All placement is performed within a rectangular region. Before anything is placed, the bounds of this region are initialized to be the full height and width of the visual container (i.e. the layout, panel, or sheet). When placement begins, each new placement consumes vertical space within the region. This automatically shrinks the region, moving the top of the region downward to the bottom of each new visual element that is placed.

Automatic placement is performed via the "autoplace" target reference. Each placement can specify a gap that should appear between the new element and the one previously placed.



   -Additional target references provide an author with complete control over
       the bounds of the region within which automatic placement is performed
       -Set these characteristics before using "autoplace" if you need to first
           manually position certain elements
       -Get these characteristics after using "autoplace" if you need to
           manually position elements in the space remaining, or if you need to
           determine the extent of the elements that were placed
       -"autoleft", "autotop", "autoright", and "autobottom" provide read/write
           access to the bounds of the region used for automatic placement
       -"autowidth" and "autoheight" provide read/write access to the dimensions
           -They default to the full width of the visual container
   -When an element is automatically placed, the width of that element is set
       to the "autowidth" of the visual container
   -When a template is automatically placed, it is rendered upon completion
   -When a layout is automatically placed, it is estimated upon completion
   -Until at least one visual element with actual contents is successfully
       placed within the container, the gap is always considered to be zero
       -This ensures that the first item actually placed in the container always
           starts at the top, regardless of how many elements render no contents
   -When automatically placed, most visual elements have their height set to the
       full remaining height of the automatic placement region
       -Lone exception is a non-table portal being placed within a layout, for
           which the height is assumed to be whatever is already set
       -Since heights are set the full region during automatic placement, it is
           assumed that visual elements will properly truncate their height as
           part of their rendering
       -For example, a template placed within a layout or a layout placed within
           a scene must properly set their height at the end of the Position
           script, based on the extent of the bottommost item within them
       -Table portals automatically determine their extent, so automatic
           placement of tables will work smoothly
   -When automatic placement attempt to place a visual element that will not
       fully fit in the remaining space, the region is considered to be fully
       utilized and no further elements can be placed
   -If a table is placed and it does not fully fit in the remaining space, as
       many items as will fit are output, with all remaining items being treated
       as "spillover" for rendering in subsequent tables
   -Any visual element that is not displayed at all is designated as non-visible
       -Tables that contain zero items are non-visible
       -Templates and layout that do not fully fit are non-visible