The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#72579 by Jsosnowski
Mon Oct 30, 2017 5:22 pm
PART SEVEN - A D4D PRIMER - Delphi Language and Forms

In addition to standard function key driven macro functionality, D4D macros provide the opportunity to expand functionality using Delphi forms and the Delphi programming language features. The Delphi programming environment includes Delphi form applications and graphic components that can be incorporated in Datacad macros to provide more complex presentations of data and functionality than DCAL Macros could. It also includes the expansive Delphi programming language allowing a much broader range of data organization and manipulation than was previously available.

As mentioned in Part 1, the DCAL language is a relative of the Pascal Language with similar structure and terms. Translation between them is relatively straightforward. Delphi provides an extension to the Pascal programming language creating an object oriented programming (OOP) language environment. It is not necessary to master the details of OOP to use it effectively in your D4D macro although a it is helpful to understand a few basic concepts. A key concept in OOP is that in addition to traditional Pascal code, programmatic 'objects' can be created. These 'objects' are created from 'Classes which define a collection of features regarding an object in a single whole. For instance, in DCal their are many variables and methods used to create and manipulate drawing entities such as 'entlin'. All are independent and operated independently in the macro. An OOP class called 'LineEnt' might contain variables for the entity such as color, location points, weight, linetype etc, as well methods for moving, copying, and stretching the line, changing its attributes, or interacting with other entities all within one package. Create an object from the class and all of its features are accessible. There are many organizational advantages to such structures, but that discussion would fill books. The key points for our discussion is that these objects co-exist with standard code, but have certain rules for their implementation which must be followed. Some of the posts in this section will use objects and the process for implementing them properly will be included in the examples.

This Part Seven section will also provide examples on how to implement Delphi Forms in D4D macros. Forms are basically program 'windows' with graphic components such as buttons, check boxes, and editing boxes to display and input data and invoke commands. Like the OOP conmcept, forms are fairly complex (they are in fact class objects themselves) in that there are an incredible number of features and components available and mastering their usage cam be challenging. Fortunately there are plenty of resources and online resources to help you advance your skills. Postings below will address some of the basics on how to incorporate forms and use some fundamental features get things up and running quicker.

Postings in this section include:

1. Adding a Form to a <name>_doMenu Procedure.
2. Linking Macro Data to the Form.
3. Saving Form Data Between Uses ('*.ini' files).
4. Saving Data to a File
5. Delphi Menus - A File Management Example
6. File Management Example - Extended
Last edited by Jsosnowski on Mon Nov 27, 2017 3:12 pm, edited 7 times in total.

Who is online

Users browsing this forum: No registered users and 25 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984