Using "Old" module
|Top Previous Next|
A) The is the complete program code in Delphi:
All you need is to use the included default editor, this is the editor which is also used by the IDE to edit the text which is contained in WPTools objects.
It uses a form (defined in unit WPDefEditor) and a data module which contains the main menu and the actions. Of course, you can edit both files but you can modify them at runtime.
The data module with the actions will be also a great help if you need to create an editor inplace, not using the provided default editor form!
Please copy both units and accompanied DFM files to a save place if you intend to modify them. Otherwise they will be replaced by the WPTools setup.
B) Even easier to use is the component TWPDefaultActions. Place this component on your form - also create a toolbar (using the TWPToolPanel - you can use Copy&Paste from unit wpDefEditor), and add a TWPRuler. Now you only have to create a link to the TWPRichText in the ControlledMemos collection of the TWPDefaultActions component.
Using the OnInit event of the TWPDefaultActions component you can modify the menu.
Please see the HLP file (=reference) for more information.
You can also use the default editor within a MDI project:
// This event for auto free !
procedure TWPMdiDemo.WPDefEditorFormClose(Sender: TObject; var Action: TCloseAction);
Action := caFree;
// Create a new wptools default editor as MDI child
procedure TWPMdiDemo.NewEditorClick(Sender: TObject);
lForm : TWPToolsEditor;
WPIsMDIApp := true; // Make the Toolbar MDI compatible
lForm := TWPToolsEditor.Create(nil);
lForm.FormStyle := fsMDIChild;
lForm.OnClose := WPDefEditorFormClose;