Top  Previous  Next


A PropertyGrid in WPTools is a special table. It consist of a header row and one or more data rows.


minimal property grid


The grid is created in code using the function TParagraph.AppendPropertyGrid.

The function returns a pointer to the data cell of the created table.


In this example first the grid is created and then the data cell is filled with text.


WPRichText1.ActivePar.AppendPropertyGrid(wpSameLevel,'TITLE').Append('DATA ROW');


Declaration of AppendPropertyGrid:


function AppendPropertyGrid(

       Level : TAppendPropertyGridMode = wpSameLevel;

       aTitle: string = '';

       aName : String = '';

       Options : TAppendPropertyGridOptions = [wpapBorder];

       FirstColumnWidth : Integer = -1;

       InplaceClass : string='';

       ModifyCellCallback : TWPAppendGridCallback = nil;

       Data : TObject = nil

       ) : TParagraph;




Level - this is the level where the grid should be created. It makes it possible to create nested grids.

The following values are supported wpSameLevel, wpNested, wpLevelUp, wpLevelUp2, wpLevelUp3.


var par : TParagraph;


 par := WPRichText1.ActivePar.AppendPropertyGrid( wpSameLevel, 'One', 'A', [wpapDontProtectData, wpapBorder]  );

 par.Append('Text in One');

 par := par.AppendPropertyGrid( wpSameLevel, 'Two' );

 par.AppendPropertyGrid( wpLevelUp, 'Two-One', 'B', [wpapDontProtectData, wpapBorder] ).Append('Text in Two-One');

 par.AppendPropertyGrid( wpLevelUp, 'Two-Two', 'C', [wpapDontProtectData, wpapBorder] ).Append('Text in Two-Two');

 par.AppendPropertyGrid( wpSameLevel, 'Three', 'D', [wpapDontProtectData, wpapBorder] ).Append('Text in Three');

 WPRichText1.ReformatAll(false, true); // repaint!




aTitle - this text will be printed in the first cell.


aName - the name for all cells.


Options - various options for the creation process.


    wpapBorder - Create a border around cells

    wpapLine - Create a bottom line

    wpapDontProtectSpacerCell - only used by AppendProperyGrid

    wpapDontProtectName - don't protect the property name cell and title

    wpapDontProtectData - Don't protect the property data cells

    wpapShaded - fill background with 50% color clLtGray. (You can use ModifyCellCallback to set any attributes!)

    wpapCollapsed - create the grid with initial collapsed state

    wpapNotCollapsable - the grid should not be collapsible

    wpapCreateInplaceEditor - Requires FieldFormat to select the editor

    wpapAppendInThisCell - Reuse the curent cell, even if not a data cell


FirstColumnWidth - this is the width of the first column in twips


InplaceClass - this name will be used to select the inplace editor class. It will be stored in the paragraph property WPAT_InplaceClass


FieldCommand - this value will be used for property WPAT_PAR_COMMAND


ModifyCellCallback - the callback to modify each created cell.

    TWPAppendGridCallback = procedure( Parent, Cell : TParagraph; Row, Col : Integer; Data : TObject ) of Object;


Data - user data which will be passed to the callback.