<< Click to Display Table of Contents >> Navigation: Tutorials > Delphi |
1.Install CADEditorX.
2.Create a new VCL Forms application - Delphi:
3.Save project in the CADEditorXTutorial folder; project name: CADEditorXTutorial.
4.Add to link to CADEditorLib_TLB to uses (You should add only the text written in bold type):
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, CADEditorLib_TLB; |
5.Add reference to CADEditorLib_TLB or copy it to the project directory (CADEditorXTutorial) from the CADEditorX Delphi demo.
6.Double-click the form and write the following code for the FormCreate event:
procedure TForm1.FormCreate(Sender: TObject); |
7.Add the private declarations SgCADEditor1: TSgCADEditor; to TForm1:
TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } SgCADEditor1: TSgCADEditor; |
8.Run the application.
9.Close the application and change the code of FormCreate:
procedure TForm1.FormCreate(Sender: TObject); begin SgCADEditor1 := TSgCADEditor.Create(Self); SgCADEditor1.Parent := Self; SgCADEditor1.Align := alBottom; SgCADEditor1.Height := 600; Height := 800; end; |
10. Add a button to the top of the form and set the “Draw line” caption:
11.Double-click the button and add the following code (the const section and CADEditorX function call):
const |
12. Run the application and press the Draw Line button. As a result you can start drawing a line in the Editor window:
The SgCADEditor1.ProcessXML function accepts parameters in XML format. You can find a lot of examples in the XML IDE application.
13. Add a new button with the Add Line caption as well as the following code:
procedure TForm1.Button2Click(Sender: TObject); |
consts CADXMLBegin and CADXMLEnd are the same as in the Draw Line button event handler.
14. Run the application and press the Add Line button. The line will be added:
The Tutorial can be found in C:\Users\User\Documents\CADEditorX 14\Demos\Tutorial.
Go to CADEditorX