Function TParagraph.AppendPropertyRow(aCaption:string; aName:string; Options:TAppendPropertyGridOptions; InplaceClass:string; FieldCommand:string; ColumnWidth:Integer; ModifyCellCallback:TWPAppendGridCallback; PropertyColCount:Integer) : TParagraph
Unit: WPRTEDefs
Class: WPRTEDefs.TParagraph
Parameters
-
aCaption:string aName:string Options:TAppendPropertyGridOptions InplaceClass:string FieldCommand:string ColumnWidth:Integer ModifyCellCallback:TWPAppendGridCallback PropertyColCount:Integer
Returns
The type of the result value is TParagraph.
Description
Creates a 2 column data row inside of a property grid. The result value is the created data column. This function will usually created a nested table inside the data cell of a property grid. Such a cell uses the property WPAT_ParFlags = WPFLG_IS_DATACELL. If the cell is not a data cell but a regular cell in a 2 column table, it will append to this table, otherwise an exception will be triggered.If the option flag wpapCreateInplaceEditor was used, a parameter FieldFormat will be used to create an inplace editor right away. Example:
This code create a property grid with 2 checkboxes.
var par : TParagraph;
i : Integer;
begin
par := WPRichText1.AddTable(1,1,true);
for I := 1 to 5 do
par.AppendPropertyRow('Row ' + IntToStr(i), 'NAME'+ IntToStr(i),
[wpapCreateInplaceEditor, wpapAppendInThisCell],
inplfrmID_check,'', 2000, AppendRowCallback, 2);
WPRichText1.ReformatAll();
WPRichText1.ReformatAll();
This callback is used to modify the inplace editors for each column. ("Row" is not used here!)
procedure TForm1.AppendRowCallback( Parent, Cell : TParagraph; Row, Col : Integer; Data : TObject );
begin
if Col>0 then
begin
Cell.ASet(WPAT_COLWIDTH, 500);
with Cell.InplaceEditor do
begin
SetGUIProp(WPINPL_CHECK_PRP_ALIGNMENT, 1);
SetGUIProp(WPINPL_PRP_ID_V_PADDING, 1);
SetGUIProp(WPINPL_PRP_ID_H_PADDING, 0);
if Col=1 then
begin
group := 3; // Using groups it is easy to find editors in the text
// they can also be used to create automatic radio elements
SetGUIProp(WPINPL_CHECK_RADIO_GROUPLEVEL, CHK_RADIO_COL); // parent column
SetGUIProp(WPINPL_PRP_ID_COLOR, $FFFFA0);
end
else
begin
group := 4;
SetGUIProp(WPINPL_PRP_ID_COLOR, clWhite );
//SetGUIProp(WPINPL_CHECK_RADIO_GROUPLEVEL, CHK_RADIO_ROW); // parent row
end;
end;
end;