|
Example: Using viewer-style methods in DBRichViewEdit |
Top Previous Next |
|
This example shows how to use DBRichViewEdit1 edits a field of table Table1.We want to load RTF file. procedure TForm1.Button1Click(Sender: TObject); begin if OpenDialog1.Execute and DBRichViewEdit1.CanChange then begin DBRichViewEdit1.Clear; DBRichViewEdit1.LoadRTF(OpenDialog1.FileName); DBRichViewEdit1.Change; DBRichViewEdit1.Format; end; end; Calling CanChange has the same effect as calling Table1.Edit. If you want to save changes in the database immediately, call Table1.Post instead of DBRichViewEdit1.Format. This sequence of actions (CanChange - modifications - Change - Format) is required only for
procedure TForm1.Button2Click(Sender: TObject); begin if OpenDialog1.Execute then DBRichViewEdit1.InsertRTFFromFileEd(OpenDialog1.FileName); end; |