|
Print/Edit elements of TWPRTFDataCollection |
Top Previous Next |
|
The demo DynAssignRTFData shows how to use the TWPPaintEngine to paint elements stored in a TWPRTFDataCollection on any Canvas. It also shows how to dynamically assign the RTFData object to an editor - so the editor can edit any of the elements in the collection!
This code is used to assign the text which should be edited:
procedure TWPDynRTFData.DynDataListDblClick(Sender: TObject); begin // Remove link to this RTF Data Object WPRichText1.RemoveRTFData; // And add link to this one WPRichText1.SetRTFData( DynDataList.Items.Objects[DynDataList.ItemIndex] as TWPRTFDataCollection); // Make sure the new text is shown WPRichText1.SetFocus; end;
The boxes are painted using TWPPaintEngine components which have been created in code in "FormCreate".
To change the RTFData which they are using this code is used after Drag&Drop: paint1.RTFData := DynDataList.Items.Objects[DynDataList.ItemIndex] as TWPRTFDataCollection;
|