1.61 class format

A format object can be used to turn a device object into a table of graphicals. Two modes are defined. In column mode, the graphicals are aligned in a two-dimensional grid that is (depending on the orientation) n columns width or high. In non-column mode, if aligns the graphicals in rows, very similar as words are placed in a paragraph of text with no aligned right margin.

A format object is just a data-object. It is interpreted by attaching it to a graphical device using device->format.

Examples:

1.61.1 Instance variables

format <-> adjustment: vector*
Applicable if format<-columns equals @on. When present it should be a vector with the same number of elements as format<-width. Each element is one of the names left, center or right and determines the placement of the graphical objects in their cell. If format<-direction = vertical left and right should actually be read as top and bottom

The following creates a three column table with the first column aligned to the left, the middle centered and the last to the right:

?- new(D, device),
   new(F, format(horizontal, 3, @on)),
   send(F, adjustment, vector(left, center, right)),
   send(D, format, F),

%  fill the table.
   send_list(D, display,
                         [ '1.1', '1.2', '1.3',
                           '2.1'
                         ]).

See also format->column_sep and format->row_sep.

format <-> column_sep: int
Distance between columns. If format<-columns = @off this is the distance between words of the paragraph. The default is 10 pixels. See also format->row_sep.
format <-> columns: bool
If @on, the graphical objects of the device are placed in a two dimensional grid. When @off the graphicals are places like words in a paragraph of text.
format <-> direction: {horizontal,vertical}
When horizontal and format<-columns equals @off the words are printed as the english do. vertical prints as the chinese do.

If format<-columns = @on, horizontal produces vertical columns.

format <-> row_sep: int
Distance between rows. With format<-direction = vertical this is the distance between columns. The default is 10 pixels.

See also format<->column_sep and format<->adjustment.

1.61.2 Send methods

format ->initialise: orientation=[{horizontal,vertical}], width=[1..], columns=[bool]
Create a format object. A format object may be attached to a graphical device object using device->format to achieve simple table layout. Arguments: