|
Create Multi View in Code |
Top Previous Next |
|
You need an event handler for the event OnInitializeRTFDataObject of the TWPRichText object. This event is executed when the text data is needed the first time. In the event handler you assign a RTFDataCollection which has been created 'outside'. You will need two variables in the TForm class:
TForm1 = class(TForm) ... public RTFData: TWPRTFDataCollection; RTFDataProps: TWPRTFProps end;
The event handler now initializes the variables and assigns them to any TWPRichText which is using this event handler.
procedure TForm1.OnInitRTFData(Sender: TObject; var RTFDataObject: TWPRTFDataCollection; var RTFPropsObject: TWPRTFProps); begin if RTFData = nil then begin RTFData := TWPRTFDataCollection.Create(TWPRTFDataBlock); RTFDataProps := TWPRTFProps.Create; RTFData.RTFProps := RTFDataProps; end; RTFDataObject := RTFData; end;
|