Class table is a subclass of class layout_manager, dealing with tabular layout of graphical objects. The functionality of this class is modelled after the HTML-3 definition of tables.
A number of classes are involved in the definition of a table:
->layout_manager.
<-layout_interface.
<-device.
Includes the table<-frame
and
table<-rules.
Updated by table->compute.->cell_padding
also accepts an integer, translating this into a size with equal width
and height. See also table->cell_spacing, table->frame, table->border.<-border, the borders of adjecent
cells will overlap, resulting in single lines between the cells. See
also table->cell_padding,
table->rules, table->frame
and table->border.->compute
will recompute the layout of the table.Please note that this vector always exist, but may not contain the
actual columns. Appended cells are stored in the table<-rows,
and the column information is updated by table->compute.
->append
location. Used to fill a table left-to-right, row-by-row. See table->append
and table->next_row.
May also be set explicitely, for example to modify the contents of a row
with a sequence of table->append
messages.See also table->rules,
controlling the lines around the individual cells.
<-row
and table<-columns.<-column
or table<-row
that has table_slice->end_group.
Note that table->frame
controlls the lines around the entire table
object.
<-current
attribute. Please note that
table_cell<-convert
wraps graphical
objects into a table cell, so graphicals can be appended directly to the
table.
After the table->append, table<-current
is incremented to the next column on this row. If there is no next
column, it will be created using table<-column.
Use table->next_row
to force the insertion point to the first column on the next row.
If the next column on this row points into a row-spanned
cell, the insertion point will be incremented to point to the first free
column after this row-spanned cell.
->rules
and table->frame.<-area.
Invoked by device->compute
of the layout_manager<-device
I'm associated with.<-device
to set the bounding box of the layout_manager<-device
(to the table<-area
of the table object).|table_row|table_column,
keep=[bool]<-cell, table<-row
or table<-column.
Deleting rows or columns holding spanned cells will deal naturally
with these cells: There location and spanning will be updated such that
they span the same set of rows/columns.
If keep is @on,
the content of the row, column or cell are kept. Otherwise the content
is visual->destroyed.
If a column is deleted, all cells that will be deleted from the table
are attached to the table_column
object. Together with
table->insert_column,
this allows for relocating columns if a table without loosing the
table-properties. Note that the column should be object->lock_object’ed
to avoid destruction by the incremental garbage collector. The following
code moves column 4 to be the first column:
... get(Table, column, 4, Col), send(Col, lock_object, @on), send(Tbale, delete, Col, @on), send(Table, insert_column, 1, Col), send(Col, lock_object, @off), ...
See also table->insert_column, table->insert_row,
table->append, table_cell->row_span
and
table_cell->col_span.
keep is @on
the graphicals are not deleted from the device. By default they are
deleted using visual->destroy.... new(D, device), send(D, layout_manager, new(T, table)), ...
Next, columns may be specified using table<-column,
and/or the table may be filled using table->append.
Note that explicit definition of columns is not required.
->insert_row
and table->delete.<-row_span
incremented. See also table->insert_column
and table->delete.<-current
to point to the first column of the next row. Used together with table->append
to fill the table left-to-right, row-by-row.->compute
to deal with the actual placement of the graphicals in the cells.|chain*Please note that selecting a table_cell
object is different from selecting the graphical image of the cell in
the associated
layout_manager<-device.
See also table<-selection.
->sort
for details.
In the current implementation, none of the sorted rows is allowed to
contain cells with row-spanning (see
table_cell->row_span)
larger than 1. If such cells are encountered, the error spanned_row is
raised.
See also table->stretched_row.
->stretched_column
for details.See also table_slice->rubber.
|name,
y=int|name -> table_cell<-row, table<-column, table->append.|event,
allow_border=[bool] -> table_cell|point
start_typing(Table, Ev:event) :->
get(Table, cell_from_position, Ev, CellOrPos),
( send(CellOrPos, instance_of, table_cell)
-> send(CellOrPos?image, keyboard_focus, @on)
; object(CellOrPos, point(X, Y)),
send(Table, append,
new(T, editable_text('')), X, Y),
send(Table, compute), % force display now
send(T, keyboard_focus, @on)
).
<-cell, table<-row
or
table<-column.|name,
create=[bool] -> table_columnNormally used to specify the column attributes:
..., get(Table, column, 1, @on, Col), send(Col, halign, center), ...
Access to the table_column
object is can also used with
table->delete
to delete a column from the table.
See also table<-row, table_slice->name.
|name,
create=[bool] -> table_rowNormally used to specify the row attributes:
..., get(Table, row 1, @on, Col), send(Col, valign, center), ...
Access to the table_row
object is can also used with
table->delete
to delete a row from the table.
See also table<-column.
->selection.