Search
Table Class
Remarks See Also
 



Tables are diagram nodes that can contain multiple cells and can be related to other nodes through their rows. Tables can represent database tables in ER diagrams or classes in class hierarchy diagrams.

 Syntax

VB6  Copy Code

Public Class Table

C++  Copy Code

class Table

 Remarks

Probably the most important property of tables is LinkStyle, which specifies whether users are allowed to draw arrows to the rows of a table, to the table as a whole entity, or both.

Tables consist of cells distributed across rows and columns. To get or set the number of rows, columns and cells, use RowsCount and ColumnsCount. The width of the columns can be set using the SetColWidth method and the height of the rows using the SetRowHeight method. The user can resize rows or columns interactively if AllowResizeRows and/or AllowResizeColumns properties are enabled. Cells can be set to span several rows and columns by assigning values larger than 1 to the CellRowSpan and CellColumnSpan properties.

Rows can be assigned to distinct sections of the table. Each section can be collapsed or expanded, hiding or showing all rows in the section except the header one. To define a section, enable the HeaderRow property for a row. A section consists of all rows after a header row and spans to the next header. Each header row displays a +/- button that allows expanding or collapsing the section interactively. The button appears either on the left of the first cell of a header row or in a separate column, as set in OffsetHeaderRows. Clicking that button raises the TableSectionCollapsed and TableSectionExpanded events. Sections can be collapsed or expanded programmatically by setting the RowExpanded property for their header rows.

The IncomingArrows and OutgoingArrows collections expose the arrows that are linked to a table as entity but not to its rows. GetRowIncomingArrows and GetRowOutgoingArrows return collections of arrows linked to a specific row. The points from which arrows are allowed to go out from a table or come into a table can be defined via the AnchorPattern and RowAnchorPattern properties.

In some situations, you might need to find out which cell occupies a specific point. You can do that by means of the RowFromPoint and ColumnFromPoint methods, which return the indices of the row and column containing that cell.

Constraints upon how users are allowed to modify a table are set through the Constraints and MnpHandlesMask properties. The former specifies constraints on move direction and table size. The latter enables or disables specific manipulation handles of the table.

The appearance of a table can be customized via FillColor, Picture and Font properties. The shape of a table is specified via Style, which currently provides support for rectangle and rounded-rectangle shapes. Outline is drawn as set via FrameColor, PenStyle and PenWidth. The CellBorders property defines the appearance of cell frame lines.

User data can be attached to a table via the Tag and VariantTag properties.

A cell can display either text with optional image, or a checkbox. This is specified via the CellType indexed property. If CellType is set to ctCheckBox, the checkbox state can be get or set via the CellValue property.

The text of a table's cell can be accessed or changed via GetText and SetText methods. The EnableStyledText property allows using HTML-like formatting tags to apply various attributes to any part of the text string. The text font and color are set through the CellFont and CellTextColor indexed properties. The ResizeToFitText method resizes the columns and rows of a table to show their text completely.

The CellFillColor, CellPicture and CellPicturePos indexed properties let you customize the table appearance further by setting the fill color and picture of cells. User data can be attached to a cell via the CellVariantTag property.

Apart from cells' text, a table can also display caption and footer. Set the Caption property to display text in the table's caption bar. Set FooterHeight to a value greater than 0 to allocate space for a footer area at the bottom of the node and set the Footer property to display text there. Use CaptionStyle and FooterStyle to specify the alignment of the caption and footer labels.

 See Also