<< Click to Display Table of Contents >> Navigation: Programming > InplaceEditors > Table cell based inplace editors |
Inplace editors can also be maintained by a table cell.
Simply call par.CreateInplaceEditor( InplaceClass ). A reference to the new inplace editor is returned.
The above sample table was created with TableAdd using this code:
var num : Integer;
begin
num := 1;
WPRichText2.TableAdd(10,10,procedure(RowNr, ColNr: Integer; par: TParagraph)
begin
par.SetText(IntToStr(num));
with par.CreateInplaceEditor(inplfrmID_check) do
begin name:='Field'+IntToStr(num);
SetGUIProp( WPINPL_PRP_ID_CHECKED, Ord(Random(5)>2) );
end;
inc(num);
end,[wptblActivateBorders]);
WPRichText2.ReformatAll(false, true);
end;
In also uses the custom paint event handler described here.
The above code also uses the new TableAdd method which can work with anonymous procedures. This makes coding easier, especially if you like to use a local variable, in this case num.