Dialog Control Language
Encyclopedia
Dialog Control Language is a high-level description language and interpreter within AutoCAD
AutoCAD
AutoCAD is a software application for computer-aided design and drafting in both 2D and 3D. It is developed and sold by Autodesk, Inc. First released in December 1982, AutoCAD was one of the first CAD programs to run on personal computers, notably the IBM PC...

 for creating simple graphical dialogs. AutoLISP
AutoLISP
AutoLISP is a dialect of Lisp programming language built specifically for use with the full version of AutoCAD and its derivatives, which include AutoCAD Map 3D, AutoCAD Architecture and AutoCAD Mechanical...

 extensions use it to interact with the user in the AutoCAD environment.

Features and usage

Unlike other major GUI APIs, DCL is not a complete GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

 toolkit for application programming. It is only intended for providing simple dialogs within AutoCAD. It includes basic form widgets such as text boxes, buttons, checkboxes and list boxes. DCL is object-oriented; it allows re-use through inheritance and composition.

DCL syntax is based on defining and using 'tiles'. A 'tile' represents a GUI widget such as a text box or a text label. Tiles also represent widgets that hold other widgets, such as columns, radio button groups and the dialogs themselves. DCL provides built-in tiles for all major widgets, and new tiles can be defined through inheritance
Inheritance (computer science)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...

 and composition
Object composition
In computer science, object composition is a way to combine simple objects or data types into more complex ones...

 of other tiles.

DCL allows interactions with the dialog at run-time by Lisp code. Certain widgets can have actions associated with them by naming an AutoLISP
AutoLISP
AutoLISP is a dialect of Lisp programming language built specifically for use with the full version of AutoCAD and its derivatives, which include AutoCAD Map 3D, AutoCAD Architecture and AutoCAD Mechanical...

 function to be run, and values to be passed to it. Unlike other types of GUIs, DCL dialogs cannot be changed substantially at run time. The contents of certain widgets such as text boxes and list boxes can be changed, but widgets cannot be removed from or added to the dialog.

Example

Here is an example DCL file (and accompanying AutoLISP
AutoLISP
AutoLISP is a dialect of Lisp programming language built specifically for use with the full version of AutoCAD and its derivatives, which include AutoCAD Map 3D, AutoCAD Architecture and AutoCAD Mechanical...

 file) demonstrating the major features of DCL.


name_button : button {
label = "Submit name";
action = "(change-name)";
}

hello : dialog {
label = "DCL Example";

: edit_box {
label = "Name: ";
key = "name";
}

: name_button {
key = "submit-name";
}

: text {
key = "greeting";
}

ok_only;
}


The dialog is created by inheriting from the built-in tile 'dialog'. Properties are set on the dialog and other widgets in name/value pairs. Tiles can be placed inside the dialog just by naming them, or by naming them and specifying additional properties. A new tile ('name_button') is defined for use by naming it and specifying properties for it.


DCL is saved as "hello.dcl"
(defun change-name
(set_tile "greeting" (strcat "Hello, " (get_tile "name") "!")))

(setq hello-dcl (load_dialog "hello.dcl"))
(new_dialog "hello" hello-dcl)
(start_dialog)
(unload_dialog hello-dcl)


A DCL dialog is instantiated by calling a series of functions in an AutoLisp file. Tiles can call back into AutoLISP
AutoLISP
AutoLISP is a dialect of Lisp programming language built specifically for use with the full version of AutoCAD and its derivatives, which include AutoCAD Map 3D, AutoCAD Architecture and AutoCAD Mechanical...

 code on certain events, and Lisp can manipulate the contents of tiles while the dialog is running.

Alternative technologies

For creating more general GUIs and other extensions within CAD, AutoDesk provides several other choices. The ObjectARX
ObjectARX
ObjectARX is an API for customizing and extending AutoCAD. The ObjectARX SDK is published by Autodesk and freely available under license from Autodesk. The ObjectARX SDK consists primarily of C++ headers and libraries that can be used to build Windows DLLs that can be loaded into the AutoCAD...

 API for C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 allows extensions to be built as within Microsoft Visual Studio. VBA
Visual Basic for Applications
Visual Basic for Applications is an implementation of Microsoft's event-driven programming language Visual Basic 6 and its associated integrated development environment , which are built into most Microsoft Office applications...

 allows drag-and-drop programming for AutoCAD
AutoCAD
AutoCAD is a software application for computer-aided design and drafting in both 2D and 3D. It is developed and sold by Autodesk, Inc. First released in December 1982, AutoCAD was one of the first CAD programs to run on personal computers, notably the IBM PC...

 as for Microsoft Office
Microsoft Office
Microsoft Office is a non-free commercial office suite of inter-related desktop applications, servers and services for the Microsoft Windows and Mac OS X operating systems, introduced by Microsoft in August 1, 1989. Initially a marketing term for a bundled set of applications, the first version of...

and other applications.

As of AutoCAD 2007 and later, AutoLISP or Visual-LISP programs can call routines written in Visual Studio .NET (VB or C#). Programmers can now create dialogs in VB or C# that have the full range of controls found in the .NET Forms API and can be called and accessed from Visual-LISP.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK