### GridControl (DataPage+)

### GridControl (TemplateBuilder)

This control inserts a customizable grid of columns and rows into your template. This unique control is more than just a standard table though. In fact, you can program the individual cells, rows, or columns using expressions to display specific information from your database. See "Expressions".

As with the other controls, you can easily resize and move this object to a new location. You can easily resize and move this object to a new location. When you resize this object, be aware that the software dynamically sizes the columns and rows to fit the object's new size.

Accessing the Grid Property Dialog Box

Once you insert a GridControl, select it, double-click on it to activate it, click in a cell, and then right-click to display the Grid Property dialog box. The Cell tab of this dialog box gives you powerful formatting and editing abilities that let you program each grid cell to your individual specifications. The Row tab lets you define repeating rows.

Grid Property Dialog Box - Cell Tab

The Grid Property dialog box - Cell Tab

Cell type - Lets you configure what you will insert into the specific cell. The options are:

- Text - This lets you type straight text or an expression command into the Cell Expression box of the Expression Editor dialog box. The evaluated expression or the straight text appears in the cell.

- Image - This inserts an image into the cell. You can select it using the Select button.

- Expression - This box lets you type an expression into the cell. Datapage+ evaluates the expression when it uses the template to display the actual report data. Use the Cell expression list for available expressions.

Select - If Cell type is set to Image, this button lets you choose an image to display inside of the selected cell. If Cell type is set to Expression, this button lets you choose the expression to insert into the cell.

Enable edit cell - If Cell type is set to Text, you can mark or clear this box to determine whether or not the cell can be edited when the template is used in the report.

Cell expression - This list lets you choose an expression to use in the cell. This expression will be used if Cell type is set to Expression. Also, see "Expressions" for descriptions of the available expressions.

Cell height and Cell width - These boxes let you define the cell's height and width in pixels. Note that if you modify a height, all cells in that row are modified. If you change the width, all cells in that column are modified. If you have varying heights and widths among multiple cells, the Even Widths and Even Heights buttons even out the height and width among the selected cells. The two Auto buttons automatically size the cell vertically or horizontally to fit the text.

Merge Cells - This button merges multiple cells together into one cell.

Unmerge Cells - This button splits previously merged cells into their original and previous unmerged state.

Cell justification - These buttons let you set the alignment of the text within the cell, either vertically or horizontally. If horizontal, your can align the text to the left, the center, or the right of the cell. If vertical, you can align the text to the top, the middle, or the bottom.

Horizontal Alignment Buttons

- Left - Aligns the text with the left side of the cell.

- Center - Aligns the text horizontally in the center of the cell.

- Right - Aligns the text with the right side of the cell.

Vertical Alignment Buttons

- Top - Aligns the text with the top of the cell.

- Middle - Aligns the text vertically in the middle of the cell.

- Bottom - Aligns the text with the bottom of the cell.

Font Size - This button lets you modify the font for the cell's text. See "Using the Font Chooser Dialog Box".

Background Color - This button defines the background color for the cell. This color works with the list to its left. If you choose SolidColorBrush, this button opens a Color Selection dialog box, allowing you to choose a color for the cell's background. See "Using the Color Selection Dialog Box". If you choose ColorExpression, this button displays an expression editor, letting you apply the =GetColor expression to determine the color. See Expressions List for info on ColorExpression. This button defines the background color for the cell. It opens a Color Selection dialog box, allowing you to choose a color. See "Using the Color Selection Dialog Box".

Text Color - This button defines the foreground text color for the cell. This color works with the list to its left. If you choose SolidColorBrush, this button opens a Color Selection dialog box, allowing you to choose a color for the cell's text. See "Using the Color Selection Dialog Box". If you choose ColorExpression, this button displays an expression editor, letting you apply the =GetColor expression to determine the color. See Expressions List for info on ColorExpression. This button defines the text color for the cell. It opens a Color Selection dialog box, allowing you to choose a color. See "Using the Color Selection Dialog Box".

Grid Property - Row Tab

The Grid Property dialog box - Row Tab

The Row tab of the Grid Property dialog box lets you set the row expression for a row in the GridControl. This allows a label template to repeat rows on the fly to view multiple axes or comments that may vary in number from feature to feature. The Repeating group check box does the following:

- It enables the Expression button. This button displays the Expression Editor, showing only row-specific expressions. Currently, the only row-specific expression available is the =RepeatRow() expression. See the "Expressions List" topic where this expression is discussed.

Expression Editor

- It also enables the RepeatedRows category in the Expression Editor available to the Cell tab. This lets you select the useful Axis-N cell-specific expression, needed for repeating rows.

RepeatedRows Category in Cell Tab's Expression Editor

Example Label Template with Repeating Row in Main Canvas | Example Label Template with Repeating Row when Applied to the CAD Tab
Consider this sample custom label template. Notice that the second row has two cells with two expressions:

- The left cell has an expression to display the current axis, N number of times where N becomes the number of axes that the feature has. This is selected from the RepeatedRows category.

- The right cell displays the current value for the feature.

The second row is a repeating row with this expression:

It will repeat each axis on a new row until finished. For the LOC9 dimension, two axes, X and Y, are displayed in the CAD tab, each with its nominal value displayed as specified in the label template.

If LOC9 had three axes, such as X,Y,Z, the row would have repeated three times, one for each label in the CAD tab.

Properties

The following properties are available for this control.

Left - This determines the position of the control from the left side of the canvas.

Top - This determines the position of the control from the top side of the canvas.

OutsideFrame - This determines the type of line used as the grid's border. The options are Thick, Thin, and None.

InsideFrame - This determines the type of line used for the grid's inside lines. The options are Thick, Thin, and None.

FrameColor - The color box shows the current color used for the grid's lines. The button to the right shows the Color Selection dialog box, allowing you to change the grid's line.

LabelType - Since the GridControl can be used in different contexts, this property defines that context for this control. For example, you can use the GridControl in the Template Builder with a Header and Footer; or you can use the GridControl inside a label template to display information for a specific data source available on the drop-down list in Datapage+'s side bar: Feature_Variable, Dimension_Variable, Feature, and Dimension.

Data Sources in Datapage+

The LabelType property contains these options: HeaderAndFooter, Variable, Feature, and Dimension. You must choose the item that corresponds to the source of the data being sent to the GridControl. For example, if your GridControl will be in a header or footer of a report template, then choose HeaderAndFooter. If it will be used in a label template to display information from the Feature_Variable or Dimension_Variable data source, choose Variable. By default, this is set to HeaderAndFooter automatically when using the Template Builder. It is set to Variable when creating custom labels.

IsTransparent - If you mark this check box, the label's background will be transparent. If you clear this check box, the label's background will be white.

ColumnDefinitions - The ... button lets you add columns to this control. Clicking it displays a Collection Editor dialog box which lists columns as column definitions. By default it always lists [0]ColumnDefinition. To add a new column to the right of all other columns, click Add Item. To insert a new column to the left of the selected column, click Insert Item. The column is inserted into the control and listed in the dialog box. To delete a column, select the desired column definition from the dialog box and click Delete Item.

Collection Editor dialog box

RowDefinitions - The ... button lets you add rows to this control. Clicking it displays a Collection Editor dialog box which lists the rows as row definitions. By default it always lists [0]RowDefinition. To add a new row to the bottom of all other rows, click Add Item. To insert a new row above the selected row, click Insert Item. The row is inserted into the control and listed in the dialog box. To delete a row, select the desired row definition from the dialog box and click Delete Item.

Name - This provides the control with a unique name. If you have more than one control of the same type on the canvas, the software will append a number to the name of the control to make it unique. You can change this to whatever name you want as long as it remains unique from other controls.

Width - This sets the width of the control. If you click the Auto icon , the width expands or shrinks to match the width used by the canvas.

Height - This sets the height of the control. If you click the Auto icon , the height expands or shrinks to match the height used by the canvas.