VID Layout Notes

Layout Notes


This short document describes different aspects of VID relevent during LAYOUT processing of a VID specification. I wrote it to get a picture of how the VID dialect works and what it does.

!You DON'T need this document to produce VID programs.


The FACETS facet is a record of the original style definition (block!) used to define the style. Styles are defined by using STYLIZE or by using the STYLE keyword of VID.


The STYLE facet of a style or face records the name of the "based on" style, that is it records from where the style or face was derived.


The WITH keyword of VID is a flexible way to incorporate lower-level specifications. The WITH block follows the same format as an object specification and like an object specificatio, executable code can be included. The WITH block is evaluated during creation of the style or face.


The WORDS facet of a style extends VID by adding facet keywords specific to the style that defines these words. With this capability a cleverly crafted stylesheet with styles having specific words could enable LAYOUT and VIEW to yield an instant visual representation of a data stream (that would not ordinarily be considered as specifying a user interface).


Like WORDS, MULTI is a way for style specific facets to be specified. In this case MULTI is an object with six fields. Each field (TEXT SIZE FILE IMAGE COLOR BLOCK) contains a function that determines how to change facets of the new style or face where multiple values of the same VID type are given. For example, how should multipe color values be treated? The object in MULTI is shared and provides default functionality.


The script in the INIT facet is executed by both LAYOUT and MAKE-FACE. It is bound to the context of the new face therefore any facets in the new face are immediately available to the script. It is run just once and can be seen as a way for a new face to initialise itself.

Actions of Layout

LAYOUT carries out six important actions when generating a layout (face): defining and retrieving styles (STYLE), processing facet specifications (BLUE), creating faces (BUTTON), setting variables (my-button:) positioning newly created faces (BELOW) and executing embedded REBOL code (DO). The ordering of these actions can be very flexible in a VID specification.

Make-Face function

MAKE-FACE creates a face using a style or face as a template. MAKE-FACE provides a /SPEC refinement so that the new face can have facets or facet values that the template does not have. MAKE-FACE requires a slightly more advanced understanding of VID than VIEW or LAYOUT because to utilise the face returned by MAKE-FACE a programmer needs be aware of and understand the PANE facet.

Miscellaneous info

SVV is an abbreviation for system/view/vid (an object!).

SVV/DO-FACETS is part of parsing process used in LAYOUT, it captures from the first to the last facet of a specified style and returns the next parsing position. That is, it picks up all the VID attributes (facet specifications) that are to be part of the new face. This includes the specific facet keywords defined in the WORDS facet for the new face.

SVV/EXPAND-SPECS changes VID facet specs for EDGE, FONT and PARA into executable object! specifications.

SVV/GROW-FACETS takes the VID facet specifications (captured by DO-FACETS essentially) and sets the facets of the new face. In addition GROW-FACETS gathers up and groups values into the six MULTI facet types and passes each set as blocks on to the MULTI facet object for processing.