Satish Lele
satish.lele@gmail.com


Dialog Boxes
load_dialog: Loads a DCL file. (load_dialog dclfile)
The dclfile argument is a string that specifies the DCL file to load. If dclfile argument does not specify a file extension, .dcl is assumed. Returns a positive integer value (dcl_id) if successful, and returns a negative integer if it can't open the file. The dcl_id is used as a handle in subsequent new_dialog and unload_dialog calls. The load_dialog function searches for files according to the AutoCAD library search path. This function is the complement of unload_dialog. An application can load multiple DCL files with multiple load_dialog calls.

new_dialog: Begins a new dialog box and displays it, and can also specify a default action. (new_dialog dlgname dcl_id [action [screen-pt]])
The dlgname argument is a string that specifies the dialog box, and dcl_id identifies the DCL file (you must have obtained its value from the load_dialog call). The action argument, which must be specified if you specify screen-pt, is a string that contains an AutoLISP expression to use as the default action. If you don't want to define a default action, pass action as the empty string ("").
The screen-pt argument is a 2D point list that specifies the X,Y location of the dialog box on the screen. The point usually specifies the upper-left corner of the dialog box, but this is platform dependent, as is the system of units in which the location is specified. If you pass the point as'(-1 -1), the dialog box is opened in the default position (the center of the AutoCAD graphics screen). If new_dialog succeeds, it returns T; otherwise it returns nil. Your application must call new_dialog before it calls start_dialog. All dialog box initialization, such as setting tile values, creating images or lists for list boxes, and associating actions with specific tiles (with the use of action_tile), must take place after the new_dialog call and before the start_dialog call. The default action is evaluated when the user picks an active tile that doesn't have an action or callback explicitly assigned to it by action_tile or in DCL. Note that always check the status new_dialog returns. Calling start_dialog when the new_dialog call failed can have unpredictable results.

start_dialog: Displays a dialog box and begins accepting user input. (start_dialog). You must first initialize the dialog box by a previous new_dialog call. The dialog box remains active until an action expression or callback function calls done_dialog. Usually done_dialog is associated with the tile whose key is "accept" (typically the OK button) and the tile whose key is "cancel" (typically the Cancel button). The start_dialog function has no arguments. It returns the optional status passed to done_dialog. The default value is 1 if the user pressed OK, 0 if the user pressed Cancel, or -1 if all dialog boxes were terminated with term_dialog. But if done_dialog is passed an integer status greater than 1, start_dialog returns this value, whose meaning depends on the application.

done_dialog: Terminates a dialog box. (done_dialog [status]). You must call done_dialog from within an action expression or callback function (see "action_tile"). If you specify the optional status argument, it must be a positive integer, which start_dialog will return instead of returning 1 for OK, or 0 for Cancel. The meaning of any status value greater than 1 depends on your application. The done_dialog function returns a two-dimensional point list that is the (X,Y) location of the dialog box when the user exited it. You can pass this point to a subsequent new_dialog call to reopen the dialog box in the user-selected location. If you provide a callback for the button whose key is "accept" or "cancel" (usually the OK and Cancel buttons), the callback must call done_dialog explicitly. If it doesn't, the user can be trapped in the dialog box. If you don't provide an explicit callback for these buttons and use the standard exit buttons, AutoCAD handles them automatically. Also, an explicit AutoLISP action for the "accept" button must specify a status of 1 (or an application-defined value); otherwise, start_dialog returns the default value, 0, which makes it appear as if the dialog box was canceled.

term_dialog: Terminates all current dialog boxes as if the user had canceled each of them. (term_dialog). If an application is terminated while any DCL files are open, AutoCAD automatically calls term_dialog. This function is used mainly for aborting nested dialog boxes. The term_dialog function always returns nil.

unload_dialog: Unloads a DCL file. (unload_dialog dcl_id). Unloads the DCL file associated with dcl_id (which was obtained from a previous new_dialog call). Always returns nil.

start_image: Starts the creation of an image in the dialog box tile. (start_image key). Subsequent calls to fill_image, slide_image, and vector_image affect this image until the application calls end_image. The key argument is a string that specifies the dialog box tile. The key argument is case sensitive. Do not use the set_tile function between start_image and end_image function calls.

end_image: Ends creation of the currently active dialog box image. (end_image). This function is the complement of start_image.

fill_image: Draws a filled rectangle in the currently active dialog box image tile. (fill_image x1 y1 wid hgt color). The fill_image function must be used between start_image and end_image calls. The color parameter is an AutoCAD color number or one of the logical color numbers shown in the following table. Symbolic names for the color attribute.
Color number                    ADI mnemonic Description

-2 BGLCOLOR          Current background of the AutoCAD graphics screen
-15 DBGLCOLOR     Current dialog box background color
-16 DFGLCOLOR     Current dialog box foreground color (text)
-18 LINELCOLOR     Current dialog box line color
The first (upper-left) corner of the rectangle is located at (x1, y1) and the second (lower-right) corner is located the relative distance (wid,hgt) from the first corner (wid and hgt must be positive values). The origin (0,0) is the upper-left corner of the image. You can obtain the coordinates of the lower-right corner by calling the dimension functions dimx_tile and dimy_tile.

slide_image: Displays an AutoCAD slide in the currently active dialog box image tile. (slide_image x1 y1 wid hgt sldname). The slide can be a slide file (.sld) or a slide in a slide library file (.slb). sldname argument specifies it as you would specify it for the VSLIDE command or for a menu file, sldname or libname(sldname). The first (upper-left) corner of the slide (its insertion point) is located at (x1,y1), and the second (lower-right) corner is located at the relative distance (wid,hgt) from the first (wid and hgt must be positive values). The origin (0,0) is the upper-left corner of the image. You obtain the coordinates of the lower-right corner by calling the dimension functions (dimx_tile and dimy_tile).

start_list: Starts the processing of a list in the list box or in the pop-up list dialog box tile. (start_list key [operation [index]]). key argument is a string that specifies the dialog box tile. The key argument is case sensitive. The operation argument is an integer value whose meaning is summarized in the following table.
List box codes for start_list:
1 Change selected list contents
2 Append new list entry
3 Delete old list and create new list (the default)
The index argument is ignored unless the start_list call begins a change operation (1), in which case index indicates the list item to change by the subsequent add_list call. The index is zero based. If you don't specify operation, it defaults to 3 (create new list), and if you specify operation but not index, the index defaults to 0. Subsequent calls to add_list affect the list started by start_list until the application calls end_list. Do not use the set_tile function between start_list and end_list function calls.

add_list: Adds or modifies a string in the currently active dialog box list. (add_list string). Before using add_list, you must open the list and initialize it with a call to start_list. Depending on the operation specified in start_list, the string either is added to the current list or replaces the current list item. Assuming that the currently active DCL file has a popup_list or list_box with a key of longlist, the following code fragment initializes the list and adds to it the text strings in llist.
(setq llist '("first line" "second line" "third line"))
(start_list "longlist")
(mapcar 'add_list llist)
(end_list)
After the list has been defined, the following code fragment changes the text in the second line to "2nd line".
(start_list "longlist" 1 0)
(add_list "2nd line")
(end_list)
(See also the start_list and end_list functions)

end_list: Ends processing of the currently active dialog box list. (end_list). This function is the complement of start_list.

client_data_tile: Associates application-managed data with a dialog box tile (client_data_tile key clientdata). The key argument is a string that specifies a tile. The key argument is case sensitive. The data is a string specified by the clientdata argument. An action expression or callback function can refer to the string as $data.

dimx_tile and dimy_tile: Retrieves the dimensions of a tile in dialog box units
(dimx_tile key) and ( dimy_tile key). The dimx_tile function returns the width of the tile, and dimy_tile returns its height. For both functions, the key argument is a string that specifies the tile. The key argument is case sensitive. The coordinates returned are the maximum allowed within the tile, because coordinates are zero based, these functions return one less than the total X or Y dimension (X-1 and Y-1). The dimx_tile and dimy_tile functions are provided for use with vector_image, fill_image, and slide_image, which require you to specify absolute
tile coordinates.

get_tile: Retrieves the current run-time value of a dialog box tile. (get_tile key). The key argument is a string that specifies the tile and is case sensitive. It returns the tile's value as a string.

set_tile: Sets the value of a dialog box tile. (set_tile key value). The key argument is a string that specifies the tile, and value is a string that names the new value to assign (initially set by the value attribute).

mode_tile: Sets the mode of a dialog box tile (mode_tile key mode). The key argument is a string that specifies the tile and is case sensitive. The mode argument is an integer value. The mode argument values are described in the following table.
0     Enable tile
1     Disable tile
2     Set focus to tile
3     Select edit box contents
4     Flip image highlighting on or off

action_tile: Assigns an action to evaluate when the user selects the specified tile in a dialog box. (action_tile key action-expression). The key and action-expression arguments are strings. The key argument is the name of the tile that triggers the action (specified as its key attribute). The key argument is case sensitive. The action-expression is evaluated when the tile is selected. The action assigned by action_tile supersedes the dialog box's default action (assigned by new_dialog) or the tile's action attribute, if these are specified. The expression can refer to the tile's current value (its value attribute) as $value, its name as $key, its application-specific data (as set by client_data_tile) as $data, its callback reason as $reason, and its image coordinates (if the tile is an image button) as $x and $y. You cannot call the AutoLISP command function from the action_tile function.
backBack top