This section describes how to use FlowChartX with Borland Delphi:
Create new project choosing "File -> New" from the menu and select "Application" from New tab in New Items dialog. Finally press OK button. Back to main menu select "Component -> Import ActiveX Control". In "Import ActiveX" dialog choose FlowChart Type Library and click "Create Unit" button. The file FLOWCHARTLib_TLB.pas is created into your Import directory. By default your Import directory is located in the Delphi directory. To install the newly imported component, you have to compile it into a package. This is done by selecting "Components -> Install Component..." from the menu. Afterwards click "Into new package" tab page, type the name for the package file into "Package file name" edit box and click OK. FlowChartX is installed in the "ActiveX" section of the "Component palette". If the palette is not present you can show it from "View -> Toolbars -> Component palette".
In addition to the FlowChartX you can add some UI components to carry out additional program functionality. In our example two buttons for easier interaction with the program are inserted - 'Modify' and 'DestBoxes'.
Now, with buttons ready, add some functionality to them by creating their event handlers. Do it by double-clicking each of the buttons. ModifyClick and DestBoxesClick methods should appear in your form class, considering the buttons' names are 'Modify' and 'DestBox' respectively. First button modifies all selected boxes appearance, while second one selects all child boxes for active selected box in the current selection (e.g. all boxes pointed by outgoing arrows). Following code snippet illustrates that:
Delphi Copy Code |
---|
procedure TForm1.ModifyClick(Sender: TObject); |
Following steps illustrate specific FlowChartX events handling. In "Dialog editor" select the control then hit "Events" tab and in Object inspector window choose the events you wish to handle and add event handler methods for them. For example you can add an event handler for BoxCreated event. Name this method OnBoxCreated. In order to give this method the desired functionality a "ColorDialog" control named ColorDialog1 should be added to form layout. Click "Dialogs" tab in "Component palette", select "ColorDialog" and create one in the form. Following code snippet illustrates how to make ColorDialog1 appear:
Delphi Copy Code |
---|
procedure TForm1.OnBoxCreated(Sender: TObject; const pBoxItem: IBoxItem); |