The AutoLisp TutorialsDCL-Dialog Control Language Written and Compiled by Kenny Ramage
[email protected] http://www.afralisp.com Copyright ©2002 Kenny Ramage, All Rights Reserved.
[email protected] http://www.afralisp.com This publication, or parts thereof, may not be reproduced in any form, by any method, for any purpose, without prior explicit written consent and approval of the author. The AUTHOR makes no warranty, either expressed or implied, including, but not limited to any implied warranties of merchantability or fitness for a particular purpose, regarding these materials and makes such materials available solely on an "AS -IS" basis. In no event shall the AUTHOR be liable to anyone for special, collateral, incidental, or consequential damages in connection with or arising out of purchase or use of these materials. The sole and exclusive liability to the AUTHOR, regardless of the form of action, shall not exceed the purchase price of the materials described herein. The Author reserves the right to revise and improve its products or other works as it sees fit. This publication describes the state of this technology at the time of its publication, and may not reflect the technology at all times in the future. AutoCAD, AutoCAD Development System, AutoLISP, Mechanical Desktop, Map, MapGuide, Inventor, Architectural Desktop, ObjectARX and the Autodesk logo are registered trademarks of Autodesk, Inc. Visual LISP, ACAD, ObjectDBX and VLISP are trademarks of Autodesk, Inc. Windows, Windows NT, Windows 2000, Windows XP, Windows Scripting Host, Windows Messaging, COM, ADO®, Internet Explorer, ActiveX®, .NET®, Visual Basic, Visual Basic for Applications (VBA), and Visual Studio are registered trademarks of Microsoft Corp. All other brand names, product names or trademarks belong to their respective holders. Contents Page Number Page 4 Page 13 Page 30 Page 55 Page 62 Page 74 Page 82 Page 93 Page 95 Page 103 Page 196 Page 255 Page 266 Page 274 Page 283 Page 317 Getting Started Dialog Box Layout Dialog Boxes Step by Step Dialog Boxes in Action Nesting and Hiding Dialogs. Hiding Dialogs Revisited. AutoLisp Message Box. AutoLisp Input Box. Referencing DCL Files. Functional Synopsis of DCL Files. DCL Attributes. Dialog Box Default Data. Attributes and Dialog Boxes DCL without the DCL File DCL Model. Acknowledgements and Links Chapter Getting Started With DCL Dialog Control Language, or DCL, always seems to frighten off a lot of Lispers. I admit, it did me too until I was forced into a situation were I had to learn it and quickly. (make it work, or you're out boy!) Well, I would hate for any of you to be in the same situation, so for the next few issues, I'll be taking you step by step, hand in hand, through the minefield of the DCL language. I will share your pain and misery, and will wipe away your tears, I will..... ("Hey Kenny, get on with it!") Oops, sorry! Anyway, where was I? Oh yeah, I will suffer.......(thump!!) As I was saying before I got this black eye, there are a few terms that you need to familiarise yourself with before we get stuck into some coding. Firstly, the dialog box itself is known as a "dialog definition". Secondly, each "control" on the dialog is known as a "tile definition". Thirdly, each "property" of a "tile" is known as a dialog "attribute". And fourthly, each "method" of a "tile" is known as an "action expression". Why? Who knows? Who cares? All I know is that it will help you immensely in understanding the AutoCAD DCL reference book if you have a basic knowledge of these terms. Right, enough waffle, I'm bored and my eye's sore. Let's have a look at some DCL coding and design ourselves a simple dialog box. Copy and paste this into Notepad and save it as "TEST_DCL1.DCL". Oh, before I forget, please ensure that you save this file, and it's namesake AutoLisp file, into a directory that is within your AutoCAD search path. //DCL CODING STARTS HERE test_dcl1 : dialog { label = "Test Dialog No 1"; : text { label = "This is a Test Message"; alignment = centered; } : button { key = "accept"; label = "Close"; is_default = true; fixed_width = true; alignment = centered; } } //DCL CODING ENDS HERE We'll have a closer look at what this all means a bit later. First, let's load some AutoLisp coding and try out our new dialog box. Copy and paste this into Notepad and save it as "TEST_DCL.LSP". ;AUTOLISP CODING STARTS HERE (prompt "\nType TEST_DCL1 to run.....") (defun C:TEST_DCL1 () (setq dcl_id (load_dialog "test_dcl1.dcl")) (if (not (new_dialog "test_dcl1" dcl_id)) (exit ) );if (action_tile "accept" "(done_dialog)" );action_tile (start_dialog) (unload_dialog dcl_id) (princ) );defun (princ) ;AUTOLISP CODING ENDS HERE Now load and run your program. A very simple dialog box containing a message should appear on your screen. It did? Good, well done!! (thunderous applause from the peanut gallery.) Right, let's dissect the DCL coding. (theme music from an old Dracula movie starts in the background.) //DCL CODING STARTS HERE Anything starting with // in DCL is regarded as a comment. test_dcl1 The name of the dialog. : dialog The start of the dialog definition { The opening bracket for the dialog definition label = "Test Dialog No 1"; The Label of the dialog definition. This is what appears in the title bar of the dialog : text The start of a text tile definition { The opening bracket for the text tile definition label = "This is a Test Message"; The label attribute of the text tile alignment = centered; The alignment attribute of the text tile } The closing bracket of the text tile : button The start of a button tile definition { The opening bracket for the button tile definition key = "accept"; The key, or name of the button tile. You will use this name to reference this button in your AutoLisp coding label = "Close"; The label attribute. What appears on it. is_default = true; The default attribute. If this is true, this button will automatically be selected if the "Enter" button is pressed fixed_width = true; Forces the button to be just large enough for the label attribute alignment = centered; The alignment attribute } The closing bracket for the button tile } The closing bracket for the dialog definition OK, that was easy hey? By the way, did you notice that each of the attribute lines finished with a semicolon? (;) Another important thing that you must remember when dealing with attributes is that their values are case sensitive. (e.g.. "True" does not equal "true".) And right after that. a dialogue file can hold various dialogue definitions (exit) Exit the program if the dialog definition is not found. Then we load the dialog definition.. Then we start the dialog.. .") Inform the user how to start the program. Then we run an action_tile statement.defun End of function (princ) Load clean Many people get confused in regards to the order of AutoLisp statements when dealing with DCL files.. Just good manners. then do the following : "(done_dialog)" Close the dialog ).Now let's have a wee look at the AutoLisp coding that puts this whole thing together. Remember. I don't blame 'em really. (if (not (new_dialog "test_dcl1" dcl_id)) Load the dialog definition and check for it's existence. we'll take it line by line : (prompt "\nType TEST_DCL1 to run. (defun C:TEST_DCL1 (/ dcl_id) Define the function and declare variables (setq dcl_id (load_dialog "test_dcl1.action_tile End of action_tile (start_dialog) Start the dialog (unload_dialog dcl_id) Unload the dialog from memory (princ) finish clean ). Again.if End if (action_tile "accept" If the user selects the tile who's name is "accept". ). we unload the dialog..dcl")) Load the dialog file and set a reference to it. I mean look at the coding above! First we load the dialog file. how to enter and retrieve values from a dialog.Where's the logic in that? Haha. Then we load the dialog definition. we'll have a look at some predefined tiles. "(done_dialog)".. . and how to validate these values. in other words. no values will be returned until (done_dialog) is called. Then we start the dialog. The dialog is displayed. which is also quoted. what we are telling the tile is this: "Remember this string. And that's it." "So. But remember. Any action_tile statement is processed IF the relevant tile is selected. When a tile that contains the (done_dialog) function is selected. But did you notice that the action_tile statement was quoted? e. that's it. In effect. Easy hey? Next. we unload the dialog and return all tile values. When I select that tile the coding runs?" Yep. the sequence is like this : First we load the dialog file. coding is pre-stored within a particular tile. then pass it back to me when the user activates you. Then we run AND REMEMBER all the action_tile statements.g. So. } } //DCL CODING ENDS HERE . : edit_box { label = "Enter Your Name :". value = "". fixed_width = true. alignment = centered. edit_width = 30. is_default = true. edit_width = 3. key = "age". key = "name". back to work!! Copy and paste this into Notepad and save it as "TEST_DCL2. //DCL CODING STARTS HERE test_dcl2 : dialog { label = "Test Dialog No 2". edit_limit = 30. edit_limit = 3.OK. tea break over. mnemonic = "A". label = "OK". mnemonic = "N". } : button { key = "accept". } : errtile { width = 34. alignment = centered. alignment = centered.DCL". } : edit_box { label = "Enter Your Age :". LSP" and then load and run it : . Copy and paste this and save it as "TEST_DCL2.defun ------------------(defun val2 () (if (< (atoi (get_tile "age")) 1) (progn ..if ).dcl")) (if (not (new_dialog "test_dcl2" dcl_id)) (exit ) ).And now the AutoLisp coding.progn (val2) ).") (defun C:TEST_DCL2 ( / dcl_id) (setq dcl_id (load_dialog "test_dcl2..if (set_tile "name" "Enter Name Here") (mode_tile "name" 2) (action_tile "name" "(setq name $value)") (action_tile "age" "(setq age $value)") (action_tile "accept" "(val1)") (start_dialog) (unload_dialog dcl_id) (alert (strcat "Your name is " name "\nand you are " age " years of age.AUTOLISP CODING STARTS HERE (prompt "\nType TEST_DCL2 to run.")) (princ) ).defun ----------------------(defun val1 () (if (= (get_tile "name") "Enter Name Here") (progn (set_tile "error" "You must enter a name!") (mode_tile "name" 2) )... but do not enter your name. After entering the relevant information select the "OK" button. Press enter again. Another error message will inform you that you have entered an invalid age.if ).AUTOLISP CODING ENDS HERE The dialog that is displayed contains two edit boxes. One to enter your name into. An alert box will display showing your details. . and one your age.defun (princ) .(set_tile "error" "Invalid Age . An error message will display informing you that you must enter your name.Please Try Again!!") (mode_tile "age" 2) ).progn (done_dialog) ). Fill in your name but leave your age blank. Now run the program again. this time with a different message. . . (done_dialog) is called. (mode_tile "name" 2) . store the value of this tile in the variable name. . edit_limit = 3.Please Try Again!!") If everything is correct. In this case we are saying "If the tile who's "key" attribute is "name" is selected. .This sets the mode of the tile who's "key" attribute is "name". the error tile is displayed. There are a few new attributes defined in this tile : mnemonic = "A". Let's have a look at the DCL coding. Now let's have a look at the AutoLisp coding. In this example. Both of these examples are know as validation.Associates the specied tile with the action expression or call back function. . all values are returned and the alert box is displayed with the relevant information." (get_tile "name") . First the "action expressions". :edit_box . The same error message will display until you enter a number equal or greater than 1. If it is not. the error tile is again displayed. edit_width = 3.This sets the intial value of the edit box. we initiate a subroutine that checks (validates) that the name information is exceptable. If this not correct. (set_tile "error" "Invalid Age .This is a predefined tile that allows the user to enter or edit a single line of text.Try it with a zero or a negative number.This defines the mnemonic character for the tile.This sets the runtime (initial) value of a tile who's "key" attribute is "name". this routine then initiates a second subroutine that validates the age value. in this case nothing.This limits the size of the edit box to 3 characters. we have used a mode of "2" that allows for overwriting of what is already in the edit box. value = "". Did you notice that we wrote : (action_tile "accept" "(val1)") instead of : (action_tile "accept" "(done_dialog)") Instead of closing the dialog when OK is selected. (set_tile "name" "Enter Name Here") . (set_tile "error" "You must enter a name!") Once the name has been validated.Retrieve the value of the tile who's "key" attribute is "name".This limits the user to typing a maximum of 3 characters. (action_tile "name" "(setq name $value)") . do you start to put the whole program together. if you follow a few simple guidelines. If you would rather call the dialog boxes from AutoCAD. OK. We are going to do exactly the same. .Dialog Box Layout Laying out Dialog Boxes in DCL can be a bit tricky and entails quite a lot of "trial and error". If you are unfamiliar with the usage of this very handy function. You don't start off by writing the whole program in one go. But. To view the dialogs throughout this tutorial. we will be making use of the Visual Lisp Editor and the "Preview DCL in Editor" function. Consider this : Rather a complicated dialog hey? Laying out a dialog is similar in way to writing a program."DCL Tile Attributes". You write the program in sections. a complicated dialog box can be simplified quite considerably. I have included AutoLisp coding that will fulfill this purpose in the download file that you can find at the end of this tutorial. you'll find step by step instructions here. Only when each part has been thoroughly tested. splitting our dialog into 3 separate DCL files before merging them all together into one. explanations for all the tile attributes are covered in this section . testing each part as you go along. As well. let's get started. I suggest you refer to this whilst going through this tutorial. your dialog should look like this : Did you notice something? The button layout "defaulted" to a column layout. Using the "Preview DCL in Editor" function. key = "cancel". But we need these two buttons to be in a row! Ok. : button { label = "OK". afra : dialog { label = "A" . mnemonic = "O". width = 12. Open a new file in the Visual Lisp editor and Copy and paste this.dcl". lets do that : . width = 12. key = "accept". namely the "OK" and "Cancel" buttons. is_default = true.Let's have a look at the button section first : We'll start off by creating a dialog with just two buttons. alignment = centered. } } Save this as "Afra. mnemonic = "C". alignment = centered. } : button { label = "Cancel". } : button { label = "Cancel". mnemonic = "O". mnemonic = "C".. is_default = true. Now we'll add the other four buttons to create our button cluster : afra : dialog { label = "A" .. } } } Your dialog should now look like this : A word of advice. width = 12. key = "accept". confusion will reign. If not? Well. alignment = centered.afra : dialog { label = "A" . key = "accept". . : row { : button { label = "OK". alignment = centered. width = 12. key = "cancel".. Do not rely on your tiles to default to columns... Rather explicitly define a column within your DCL Coding. : column { : row { : button { label = "OK". } } : row { : button { label = "Help. key = "help".". width = 12. mnemonic = "C".". key = "About". width = 12.mnemonic = "O". } : button { label = "Load". key = "cancel". alignment = centered. . mnemonic = "H". alignment = centered. } : button { label = "Cancel". mnemonic = "L". width = 12. key = "save".. is_default = true. width = 12. mnemonic = "S". alignment = centered.. key = "load". alignment = centered. width = 12. } } : row { : button { label = "Save". mnemonic = "H".. alignment = centered. } : button { label = "About.. } } : row { : button {label = "Save".mnemonic = "C".} : button {label = "Cancel". you could also write the DCL coding like this : afra : dialog { label = "A" .alignment = centered. key = "accept". width = 12. width = 12. key = "cancel". you did! And why? Think about it!!! For the sake of readability. mnemonic = "O". and to save some space. width = 12. alignment = centered. } } } } And.key = "load".} } : row { . mnemonic = "S". width = 12.} : button {label = "Load". is_default = true. alignment = centered. alignment = centered. width = 12. alignment = centered. our dialog should now look like this : Did you notice how only one of the button tiles has the "is_default" attribute set to "true"? Good. key = "save". : column { : row { : button {label = "OK". mnemonic = "L". : button {label = "Help. width = 12. mnemonic = "H". width = 12. alignment = centered."..} : button {label = "About.} } } } . alignment = centered.. key = "help"."... mnemonic = "H". key = "About". } : edit_box {key = eb2.} } : row { : text {label = " 6". value = "000.} : text {label = "Chainage". value = "00.} : edit_box {key = eb2b. width = 7. value = "00. value = "000.} : edit_box {key = eb5a. width = 7.000".} : text {label = "Chainage". width = 7. value = "00.} : text {label = "Proposed".} } : row { : text {label = " 5". width = 7.000".} : edit_box {key = eb5.000".} .000".} : edit_box {key = eb4a.} } : row { : text {label = " 4". value = "00.} : edit_box {key = eb6.000". width = 7.000".000".000". value = "00. value = "000.} : edit_box {key = eb2c.000".} : edit_box {key = eb4b. width = 7. width = 7.000".000".000". width = 7.} : edit_box {key = eb1a. width = 7. width = 7.} : edit_box {key = eb5c. width = 7. value = "00. value = "000. value = "00.} : edit_box {key = eb5b.000".} : edit_box {key = eb2a. now sit up straight and pay attention.} : edit_box {key = eb1c.000". width = 7.} : edit_box {key = eb3a.} : edit_box {key = eb4. value = "000. width = 7.000". Open a new file and copy and paste this into it : afra1 : dialog { label = "B" .} } : row { : text {label = " 1". : column { : row { : text {label = "No". value = "00.Right.000".} } : row { : text {label = " 2".} : edit_box {key = eb3.} : edit_box {key = eb3b. value = "000. width = 7. value = "00.000". width = 7. width = 7.} : text {label = "Existing". width = 7. width = 7.000". width = 7. value = "000.} : edit_box {key = eb1.} : edit_box {key = eb1b. value = "000. value = "000.} : edit_box {key = eb3c. width = 7. value = "000.000".} } : row { : text {label = " 3". value = "00. width = 7. value = "000.000".000".} : edit_box {key = eb4c. value = "00.000".} } : row { : text {label = " 7".} : edit_box {key = eb14a. width = 7.} : edit_box {key = eb7a.} : edit_box {key = eb8.} : edit_box {key = eb8a.000".} : edit_box {key = eb14b.} : edit_box {key = eb10a.} : edit_box {key = eb13. width = 7.000".} : edit_box {key = eb7c.000".000". value = "00. value = "000. value = "000.000". width = 7. width = 7.} : edit_box {key = eb13a.} : edit_box {key = eb7b.000".: edit_box {key = eb6a.} : edit_box {key = eb9c.000".000". width = 7.000". width = 7. value = "00.000". value = "00. value = "000. width = 7. value = "000. width = 7.} : edit_box {key = eb11.} : edit_box {key = eb7. value = "00.} : edit_box {key = eb9b. value = "00.000". width = 7. width = 7.} .000".} : edit_box {key = eb11b. value = "000. value = "00.} : edit_box {key = eb10c.} : edit_box {key = eb11c.000".} : edit_box {key = eb12. value = "00. width = 7. width = 7. width = 7. value = "00.000". value = "000.} : edit_box {key = eb12b. value = "00. width = 7. width = 7. width = 7. width = 7.} } : row { : text {label = "11". width = 7. width = 7. value = "000. value = "00.000".000".} : edit_box {key = eb8c. width = 7. width = 7. value = "000.} : edit_box {key = eb6b. value = "000.} } : row { : text {label = "12". value = "00. width = 7. value = "000.} : edit_box {key = eb9.} : edit_box {key = eb10b. width = 7.} : edit_box {key = eb13b.} : edit_box {key = eb12a. value = "000. width = 7.000". value = "000. width = 7.000".} : edit_box {key = eb12c. value = "00.} : edit_box {key = eb8b. value = "00.000".} : edit_box {key = eb6c.000".} : edit_box {key = eb10. width = 7. width = 7.} } : row { : text {label = " 8".} } : row { : text {label = " 9".000".} : edit_box {key = eb11a.} : edit_box {key = eb9a. value = "00.000". value = "000. value = "000. width = 7.000".000".} } : row { : text {label = "14". value = "00. value = "000.000". value = "000.} : edit_box {key = eb14.} } : row { : text {label = "13".000".000".000". width = 7.000". value = "00. width = 7. width = 7.000". width = 7.} } : row { : text {label = "10".000". value = "000.} : edit_box {key = eb13c. width = 7.000".000". width = 7. 000".} } } ok_only. value = "000. value = "000. width = 7. width = 7.000". Ok.000".} } : row { : text {label = "15". value = "00.000".dcl". value = "00. } Save this as "afra1. Now view the dialog : Did you notice how we where forced to include an "OK" button within the dialog? Don't worry though. we'll remove that later. value = "00.} : edit_box {key = eb15c.: edit_box {key = eb14c.000".} : edit_box {key = eb15b. width = 7. on to the next section. width = 7.} : edit_box {key = eb15.} : edit_box {key = eb15a. width = 7. Open a new file and add this coding : . } : toggle {key = "tg1".} : edit_box {key = "eb18". : column { : edit_box {key = "eb16". value = "200". value = "50". edit_width = 12. value = "200".} } ok_only. value = "00. label = "Title". : column { : edit_box {key = "eb16".000". label = "Top Level".value = "00.value = "00.} : edit_box {key = "eb20".} : edit_box {key = "eb19". label = "Horizontal Scale 1 :". label = "Description On/Off". edit_width = 12. label = "Horizontal Scale 1 :".afra2 : dialog { label = "C" .000".} : edit_box {key = "eb19". edit_width = 12.000". edit_width = 12.dcl" and then display it.} : edit_box {key = "eb18". edit_width = 12. .value = "Chainage". label = "Base Level".} : edit_box {key = "eb17". } Save this as "afra2. edit_width = 12. value = 1. label = "Vertical Scale 1 :". edit_width = 20. label = "Vertical Scale 1 :". edit_width = 12.} : edit_box {key = "eb17". label = "Base Level". label = "Top Level". value = "00. It will look like this : Now let's add the the other two text boxes : afra2 : dialog { label = "C" .000". label = "File Name". value = "default".} : edit_box {key = "eb21". edit_width = 20. edit_width = 20.edit_width = 12.} : edit_box {key = "eb22". label = "Description On/Off".} : edit_box {key = "eb20". value = "Chainage". } This will give us this : Ok. edit_width = 20. label = "Path". label = "Title". value = "50".} : toggle {key = "tg1". This is what we need to do : . value = 1. time now to put this all together.} } ok_only. value = "C:\\". 000".The following coding is a merged version of the three dialog boxes that you have just created: afralisp : dialog { label = "Cross Section Level Information" . value = "000.} : text {label = "Chainage". value = "00.000".} } . value = "00. width = 7. width = 7. : row { : boxed_column { : row { : text {label = "No". width = 7.} : edit_box {key = eb1c.000".} : text {label = "Chainage".} : edit_box {key = eb1.} : edit_box {key = eb1b.} } : row { : text {label = " 1".} : edit_box {key = eb1a. width = 7.} : text {label = "Existing".000".} : text {label = "Proposed". value = "000. 000". width = 7.000".} : edit_box {key = eb8c.} : edit_box {key = eb6c.000".000". value = "00. width = 7. width = 7. value = "00. width = 7.000". width = 7. value = "000. width = 7. width = 7.} .} : edit_box {key = eb2a.000".: row { : text {label = " 2".000". value = "000. width = 7. value = "000. value = "000. width = 7. width = 7.} : edit_box {key = eb2c. value = "00.000".} : edit_box {key = eb7.} : edit_box {key = eb3b. value = "000. width = 7. value = "00.} : edit_box {key = eb9b. width = 7. value = "00.} : edit_box {key = eb7b. value = "000. width = 7. width = 7.} : edit_box {key = eb8.000". width = 7. value = "00.} : edit_box {key = eb5b.000". value = "000. width = 7.} : edit_box {key = eb5a.} } : row { : text {label = "10". width = 7.} : edit_box {key = eb8b.} : edit_box {key = eb6b.000".} : edit_box {key = eb3c.} : edit_box {key = eb9c.} } : row { : text {label = " 6". width = 7. value = "00.} : edit_box {key = eb4a. value = "000. width = 7.000".000".000".} : edit_box {key = eb4c.} } : row { : text {label = " 5".} } : row { : text {label = " 4". value = "00.} : edit_box {key = eb3. width = 7. width = 7.} } : row { : text {label = " 9".000". value = "000. width = 7.} : edit_box {key = eb6a.000".} } : row { : text {label = " 8".} } : row { : text {label = " 7".} : edit_box {key = eb6. value = "00.} : edit_box {key = eb7a. value = "00. value = "000.000".000". value = "000.000". value = "000.} } : row { : text {label = " 3".000".000". width = 7. width = 7.} : edit_box {key = eb5c. width = 7. value = "00.} : edit_box {key = eb7c. value = "00. width = 7.000". width = 7.000". value = "000.000".} : edit_box {key = eb2b. width = 7.000". value = "00. width = 7. value = "000.000".000". value = "00.} : edit_box {key = eb4b. value = "00.000".000". value = "000.} : edit_box {key = eb8a. width = 7.} : edit_box {key = eb9. value = "000.} : edit_box {key = eb5.} : edit_box {key = eb4.} : edit_box {key = eb3a.000". value = "00. width = 7.} : edit_box {key = eb2. width = 7.000".000".} : edit_box {key = eb9a. value = "00. value = "00.} } : row { : text {label = "12". value = "000. value = "00. width = 7.} : edit_box {key = eb11.} : edit_box {key = "eb17". label = "Vertical Scale 1 :". value = "00.} : edit_box {key = eb11b.} : edit_box {key = eb11a. edit_width = 12. value = "000. width = 7.000". label = "Description On/Off".} : edit_box {key = eb15c.000". width = 7. value = "000.} : edit_box {key = eb12c.000".} : edit_box {key = eb15. width = 7.} } } : boxed_column { : edit_box {key = "eb16". width = 7. width = 7.000". value = "200". width = 7. value = "00.000". width = 7. edit_width = 20.000".000". value = "00.} : edit_box {key = eb10b. width = 7.} : toggle {key = "tg1".000". value = "000.000". edit_width = 12.} : edit_box {key = eb12a.000". width = 7.} : edit_box {key = eb14b.000".} : edit_box {key = eb13a. width = 7.000". value = "000.} : edit_box {key = eb13b. value = "000.000".000". value = "000.} } : row { : text {label = "13".000". width = 7. value = "000. width = 7.} : edit_box {key = eb12.000".000". value = "000.} : edit_box {key = "eb18".} : edit_box {key = eb10c.} : edit_box {key = eb13c. value = "000. value = 1.000". value = "00.} } : row { : text {label = "14".} : edit_box {key = eb13.000". value = "00.} : edit_box {key = eb14c.: edit_box {key = eb10.000". width = 7. width = 7.value = "00.} : edit_box {key = eb15a.} : edit_box {key = "eb20". value = "00.000".} : edit_box {key = eb11c. value = "000.} } : row { : text {label = "11". edit_width = 12.000".000". width = 7.} : edit_box {key = eb14. value = "000. value = "00. width = 7.} : edit_box {key = eb10a.000".} . label = "Title". label = "Base Level". width = 7. width = 7. value = "00. value = "00.} : edit_box {key = "eb19".} : edit_box {key = eb15b.000". label = "Horizontal Scale 1 :".} : edit_box {key = eb12b. width = 7. width = 7. value = "50". value = "00. label = "Top Level". width = 7. width = 7.} : edit_box {key = eb14a. edit_width = 12.000". width = 7.} } : row { : text {label = "15". value = "Chainage". alignment = centered.} } : row { : button {label = "Save". width = 12. value = "default".} } } } } Save this as "AfraLisp. alignment = centered. width = 12. value = "C:\\". mnemonic = "L". Your merged dialog will now look like this : .dcl". key = "accept". edit_width = 20. edit_width = 20. mnemonic = "H". alignment = centered. alignment = centered. label = "File Name".} : button {label = "About. key = "help".} : button {label = "Load".. width = 12.: edit_box {key = "eb21".} : button {label = "Cancel".key = "load". width = 12... key = "About". mnemonic = "S". is_default = true.mnemonic = "C".". alignment = centered. mnemonic = "H".".} : edit_box {key = "eb22". mnemonic = "O". width = 12. width = 12. key = "cancel". key = "save".} } : row { : button {label = "Help.. alignment = centered. label = "Path".} : row { : button {label = "OK". to get a closer match. I'm out of here to fetch myself a beer. mess around with boxed columns. if you are that way inclined. and spacers. and if you feel the need. I admit that it's not exactly the same but it's as close as dammit. then go for it!!! Me. .Ok. You could. boxed rows. open AutoCAD.Previewing DCL Files Firstly. Select "OK" Your dialog should be displayed. . select : Tools -> Interface Tools -> Preview DCL in Editor Enter your dialog name if it is not already displayed. Once your DCL file has opened. Now open the Visual Lisp Editor : Tools -> AutoLisp -> Visual Lisp Editor Open the DCL file that you wish to view : File -> Open Select "DCL Source Files" from the "Files of Type" and then select your DCL file. A Paragraph tile containing Text. An Edit Box to enter Notes.not (exit) ).if (action_tile "cancel" . also for the length of the slot.test for dialog . An Edit Box for the length of the slot. A Slider.dcl")) (if (not (new_dialog "samp1" dcl_id) ).define function .load dialog .exit if no dialog . DCL File. (You can refer to the AutoCAD Customization Manual for more examples. The dialog box will look like this : Let's look at the DCL coding for this dialog : samp1 : dialog { label = "Structural Holes" .Step by Step This tutorial will take you through all the steps of designing an AutoLISP routine with.if cancel button pressed . a Dialog Box Interface. Let's start with a very simple Dialog Box containing simply. An OK/Cancel pre-defined set of tiles. It will guide you through the coding of the DCL file.Dialog Boxes . This is a standard tile set as defined in the AutoCAD Base. A Boxed Row containing 2 Toggle Buttons. ok_cancel . to the retrieval of the data from the Dialog Box. A Drop Down List Box for the size of the bolt. an OK button and a cancel button.) Now for the AutoLISP coding that calls the dialog and handles each tile : (defun C:samp1 () (setq dcl_id (load_dialog "samp1. An Image Tile. The dialog box we will be designing will consist of the following : A Radio Column consisting of 6 Radio Buttons to allow the user to choose the type of bolt. } //dialog name //give it a label //predifined OK/Cancel //end dialog Note the use of the predefined OK/Cancel tile. } : text_part { label = "by Kenny Ramage". Only the DCL file changes here. the AutoLISP coding remains the same except for the function name. NOTE : //* preceding the comments denotes new coding : The revised DCL coding looks like this : samp2 : dialog { label = "Structural Holes" .action tile (start_dialog) (unload_dialog dcl_id) (princ) ).defun C:samp (princ) . set flag .unload Let's add a paragraph of text to the dialog. ok_cancel . : paragraph { : text_part { label = "Designed and Created".close dialog."(done_dialog) (setq userclick nil)" ).start dialog . set flag .if O.action_tile (action_tile "accept" " (done_dialog)(setq userclick T))" ).close dialog.define function . pressed .K. } } } //dialog name //give it a label //predifined OK/Cancel //*define paragraph //*define text //*give it some text //*end text //*define more text //*some more text //*end text //*end paragraph //end dialog And the coding remains the same except for name change : (defun C:samp2 () . set flag . ok_cancel .0 .K.exit if no dialog . set flag .test for dialog . } : paragraph { //dialog name //give it a label //predifined OK/Cancel //define row //*define image tile //*give it a name //*and a height //*and now a width //*end image //define paragraph .not (exit) ). width = 1.if cancel button pressed .if (action_tile "cancel" "(done_dialog) (setq userclick nil)" ).close dialog.close dialog.action_tile (action_tile "accept" " (done_dialog)(setq userclick T))" ).start dialog . height = 1. pressed .load dialog .defun C:samp (princ) .(setq dcl_id (load_dialog "samp2.if O. : row { : image { key = "im" .action tile (start_dialog) (unload_dialog dcl_id) (princ) ).unload Now we will add an image tile to make it look nice : The DCL coding : samp3 : dialog { label = "Structural Holes" .dcl")) (if (not (new_dialog "samp2" dcl_id) ).0 . set flag .start dialog .*fill it with blue .if cancel button pressed .close dialog.action_tile (action_tile "accept" " (done_dialog)(setq userclick T))" ).close dialog.if O.*start the image . } } } } //define text //give it some text //end text //define more text //some more text //end text //end paragraph //end row //end dialog Because we haven't given the image tile a fixed height or a fixed width.K. } : text_part { label = "by Kenny Ramage". set flag .load dialog .setq (start_image "im") (fill_image 0 0 w h 5) (end_image) (action_tile "cancel" "(done_dialog) (setq userclick nil)" ).*get image tile width .if (setq w (dimx_tile "im") h (dimy_tile "im") ).define function .*get image tile height . it will expand or contract to suit the available space.exit if no dialog . pressed .: text_part { label = "Designed and Created".dcl")) (if (not (new_dialog "samp3" dcl_id) ).unload . Now the AutoLISP coding : (defun C:samp3 () (setq dcl_id (load_dialog "samp3.*end image .defun C:samp (princ) .not (exit) ).action tile (start_dialog) (unload_dialog dcl_id) (princ) ).test for dialog . *get image tile width .*end image .*get image tile height This retrieves the width and height of the image tile and allocates them to variables w and h respectively. The next code fragment uses these variables to "draw" the image tile.*start the image .Note the following coding : (setq w (dimx_tile "im") h (dimy_tile "im") .*fill it with blue . The number "5" denotes the AutoCAD colour "Blue" : (start_image "im") (fill_image 0 0 w h 5) (end_image) . label = "Bolt Holes &Ctsnk" . label = "Bolt Holes Sho&p" . label = "Bolt Holes &Elevation" . } : radio_button { key = "rb6" . : radio_button { key = "rb1" . } : radio_button { key = "rb5" . } : radio_button { key = "rb3" . value = "1" . } : radio_button { key = "rb4" . The DCL coding : samp4 : dialog { label = "Structural Holes" . This is to allow the user to select the type of bolt. :boxed_radio_column { label = "Type" . } : radio_button { key = "rb2" . //dialog name //give it a label //*define radio column //*give it a label //*define radion button //*give it a name //*give it a label //*switch it on //*end definition //*define radio button //*give it a name //*give it a label //*end definition //*define radio button //*give it a name //*give it a label //*end definition //*define radio button //*give it a name //*give it a label //*end definition //*define radio button //*give it a name //*give it a label //*end definition //*define radion button //*give it a name . label = "Bolt Holes &Hidden" .We are now going to add a set of radio buttons enclosed in a radio column. label = "Bolt Holes &Site" . not (exit) ). } } ok_cancel .dcl")) (if (not (new_dialog "samp4" dcl_id) ). } } } } //*give it a label //*end definition //*end radio column //predifined OK/Cancel //define row //define image tile //give it a name //and a height //and now a width //end image //define paragraph //define text //give it some text //end text //define more text //some more text //end text //end paragraph //end row //end dialog And the AutoLISP coding : (defun C:samp4 () (setq dcl_id (load_dialog "samp4. } : text_part { label = "by Kenny Ramage".load dialog .fill it with blue .0 . : row { : image { key = "im" .0 .define function . } : paragraph { : text_part { label = "Designed and Created". height = 1.exit if no dialog .*store hole type .setq (start_image "im") (fill_image 0 0 w h 5) (end_image) (action_tile "rb1" "(setq hole \"site\")") (action_tile "rb2" "(setq hole \"shop\")") (action_tile "rb3" "(setq hole \"hid\")") .get image tile width .start the image .label = "Bolt Holes &Slotted" .get image tile height .*store hole type . width = 1.if (setq w (dimx_tile "im") h (dimy_tile "im") ).test for dialog .*store hole type .end image . The DCL coding : samp5 : dialog { label = "Structural Holes" .if cancel button pressed .*store hole type .start dialog .action tile (start_dialog) (unload_dialog dcl_id) (princ) ).*store hole type . set flag .defun C:samp (princ) . : radio_button { //dialog name //give it a label //*define row //define radio column //give it a label //define radion button .K. : row { :boxed_radio_column { label = "Type" . set flag .action_tile (action_tile "accept" " (done_dialog)(setq userclick T))" ).if O. pressed .unload Now we'll add a drop down list so that we can select the bolt size.close dialog.close dialog.*store hole type .(action_tile "rb4" "(setq hole \"ctsk\")") (action_tile "rb5" "(setq hole \"elev\")") (action_tile "rb6" "(setq hole \"slot\")") (action_tile "cancel" "(done_dialog) (setq userclick nil)" ). } : radio_button { key = "rb4" . label = "Bolt Holes &Site" .0 . height = 1. } : radio_button { key = "rb3" . } } } ok_cancel . label = "Bolt Holes &Elevation" . value = "5" . //give it a name //give it a label //switch it on //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radion button //give it a name //give it a label //end definition //end radio column //*define boxed column //*give it a label //*define popup list //*give it a name //*initial value //*end list //*end boxed column //*end row //predifined OK/Cancel //define row //define image tile //give it a name //and a height //and now a width //end image //define paragraph //define text //give it some text . : row { : image { key = "im" . } : radio_button { key = "rb6" . } } : boxed_column { label = "&Size". width = 1. value = "1" . label = "Bolt Holes &Slotted" .key = "rb1" . label = "Bolt Holes Sho&p" . : popup_list { key = "selections". } : radio_button { key = "rb5" .0 . label = "Bolt Holes &Hidden" . } : paragraph { : text_part { label = "Designed and Created". label = "Bolt Holes &Ctsnk" . } : radio_button { key = "rb2" . dcl")) (if (not (new_dialog "samp5" dcl_id) ).get image tile width .store .get image tile height .Now the AutoLISP coding : (defun C:samp5 () (setq siz "M20") (setq NAMES '("M6" "M8" "M10" "M12" "M16" "M20" "M24" "M30") ).start the image .*preset hole size .setq (setq dcl_id (load_dialog "samp5.store .*fill the list box .setq (start_image "im") (fill_image 0 0 w h 5) (end_image) (start_list "selections") (mapcar 'add_list NAMES) (end_list) (action_tile (action_tile (action_tile (action_tile (action_tile (action_tile "rb1" "rb2" "rb3" "rb4" "rb5" "rb6" "(setq "(setq "(setq "(setq "(setq "(setq hole hole hole hole hole hole \"site\")") \"shop\")") \"hid\")") \"ctsk\")") \"elev\")") \"slot\")") .test for dialog (action_tile "cancel" .*start the list box .store .if (setq w (dimx_tile "im") h (dimy_tile "im") )..fill it with blue . Looks good hey..exit if no dialog .if cancel button pressed .store . } } } } //end text //define more text //some more text //end text //end paragraph //end row //end dialog Note how we have put the Radio Column and the Drop Down List box into a Row.*end list .not (exit) ).store .*define list .load dialog .} : text_part { label = "by Kenny Ramage".store hole hole hole hole hole hole type type type type type type .end image .define function .. was selected .*get list selection .action_tile (action_tile "accept" (strcat "(progn (setq SIZ (atof (get_tile \"selections\")))" " (done_dialog)(setq userclick T))" ).*check O.start dialog .unload . pressed .progn ).string 'em together .K. set flag .*get the size .*convert to integer . set flag .close dialog."(done_dialog) (setq userclick nil)" ).action tile (start_dialog) (unload_dialog dcl_id) (if userclick (progn (setq SIZ (fix SIZ)) (setq SIZ (nth SIZ NAMES)) ).close dialog.if O.K.strcat ).if userclick (princ) ).defun C:samp (princ) . label = "Bolt Holes &Site" . label = "Bolt Holes &Elevation" . } : radio_button { key = "rb5" . if a slotted hole is chosen. label = "Bolt Holes Sho&p" . The DCL coding : samp6 : dialog { label = "Structural Holes" . Note that the Edit Box and Slider only become active if the slotted bolt radio button is selected. label = "Bolt Holes &Ctsnk" . } : radio_button { key = "rb3" . //dialog name //give it a label //define row //define radio column //give it a label //define radion button //give it a name //give it a label //switch it on //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label .Let us now add an Edit Box and a slider so that the user can enter the size of the slot. : radio_button { key = "rb1" . : row { :boxed_radio_column { label = "Type" . value = "1" . } : radio_button { key = "rb2" . } : radio_button { key = "rb4" . label = "Bolt Holes &Hidden" . min_value = 0. width = 1. } : paragraph { : text_part { label = "Designed and Created". } : text_part { label = "by Kenny Ramage". } } } } //end definition //define radion button //give it a name //give it a label //end definition //end radio column //define boxed column //give it a label //define popup list //give it a name //initial value //end list //end boxed column //end row //*define edit box //*give it a name //*give it a label //*6 characters only //*end edit box //*defin slider //*give it a name //*upper value //*lower value //*initial value //*end slider //predifined OK/Cancel //define row //define image tile //give it a name //and a height //and now a width //end image //define paragraph //define text //give it some text //end text //define more text //some more text //end text //end paragraph //end row //end dialog .0 . max_value = 100. edit_width = 6 . } : slider { key = "myslider" . value = "5" . } } } : edit_box { key = "eb1" . } } : boxed_column { label = "&Size". : row { : image { key = "im" . label = "Slot &Length (O/All Slot)" . height = 1. label = "Bolt Holes &Slotted" .} : radio_button { key = "rb6" . : popup_list { key = "selections".0 . } ok_cancel . value = "50". And now the AutoLISP coding : (defun C:samp6 () (setq lngth 50.*is user enters slot length .store hole type .*put data into edit box .end list .*check values .*define function .0) (setq hole "site") (setq siz "M20") (setq NAMES '("M6" "M8" "M10" "M12" "M16" "M20" "M24" "M30") ).start the list box .setq (setq dcl_id (load_dialog "samp6.*check values .not (exit) ).fill the list box .*pass arguments to .load dialog .*define function .dcl")) (if (not (new_dialog "samp6" dcl_id) ).start the image .*if user moves slider .test for dialog .*disable edit box .fill it with blue .store hole type .define function .end image .preset hole type .preset hole size .get image tile height .*update edit box .*preset slot length .*pass arguments to .exit if no dialog .if (setq w (dimx_tile "im") h (dimy_tile "im") ).store hole type .*update slider .setq (start_image "im") (fill_image 0 0 w h 5) (end_image) (start_list "selections") (mapcar 'add_list NAMES) (end_list) (set_tile "eb1" "50") (mode_tile "eb1" 1) (mode_tile "myslider" 1) (action_tile "myslider" "(slider_action $value $reason)") slider_action (action_tile "eb1" "(ebox_action $value $reason)") ebox_action (defun slider_action (val why) (if (or (= why 2) (= why 1)) (set_tile "eb1" val))) (defun ebox_action (val why) (if (or (= why 2) (= why 1)) (set_tile "myslider" val))) (action_tile "rb1" "(setq hole \"site\")") (action_tile "rb2" "(setq hole \"shop\")") (action_tile "rb3" "(setq hole \"hid\")") .*disable slider .get image tile width .define list . if O.store hole type .store hole type .*enable slider .K.action tile (start_dialog) (unload_dialog dcl_id) (if userclick (progn (setq SIZ (fix SIZ)) (setq SIZ (nth SIZ NAMES)) ). was selected .get list selection . let's add some toggles : .string 'em together .*switch focus to edit box (action_tile "cancel" "(done_dialog) (setq userclick nil)" ).if cancel button pressed . set flag .store hole type .*enable edit box .action_tile (action_tile "accept" (strcat "(progn (setq SIZ (atof (get_tile \"selections\")))" "(setq lngth (atof (get_tile \"eb1\")))" " (done_dialog)(setq userclick T))" ). pressed .check O.start dialog .unload .strcat ).*get slot length .(action_tile "rb4" "(setq hole (action_tile "rb5" "(setq hole (action_tile "rb6" "(setq hole (mode_tile (mode_tile (mode_tile \"ctsk\")") \"elev\")") \"slot\") \"eb1\" 0) \"myslider\" 0) \"eb1\" 2)") .close dialog. set flag .progn ).if userclick (princ) ).close dialog.K.get the size Now.convert to integer . for the fun of it.defun C:samp (princ) . label = "Bolt Holes &Elevation" . } : radio_button { key = "rb2" . : row { :boxed_radio_column { label = "Type" . label = "Bolt Holes &Hidden" . : radio_button { key = "rb1" . value = "1" . } : radio_button { key = "rb3" .Here is the DCL coding : samp7 : dialog { label = "Structural Holes" . } : radio_button { key = "rb5" . } : radio_button { key = "rb4" . label = "Bolt Holes &Site" . } //dialog name //give it a label //define row //define radio column //give it a label //define radion button //give it a name //give it a label //switch it on //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition . label = "Bolt Holes Sho&p" . label = "Bolt Holes &Ctsnk" . : popup_list { key = "selections". } : slider { key = "myslider" .: radio_button { key = "rb6" .0 . height = 1. } } ok_cancel .0 . : row { : image { key = "im" . } :boxed_row { :toggle { key = "tog1". } } : boxed_column { label = "&Size". } } } : edit_box { key = "eb1" . //define radion button //give it a name //give it a label //end definition //end radio column //define boxed column //give it a label //define popup list //give it a name //initial value //end list //end boxed column //end row //define edit box //give it a name //give it a label //6 characters only //end edit box //defin slider //give it a name //upper value //lower value //initial value //end slider //*define boxed row //*define toggle //*give it a name //*give it a label //*end toggle //*define toggle //*give it a name //*give it a label //*end definition //*end boxed row //predifined OK/Cancel //define row //define image tile //give it a name //and a height //and now a width //end image //define paragraph //define text //give it some text . } :toggle { key = "tog2". value = "50". max_value = 100. } : paragraph { : text_part { label = "Designed and Created". min_value = 0. edit_width = 6 . label = "Slot &Length (O/All Slot)" . label = "Snap On/Off". label = "Bolt Holes &Slotted" . width = 1. label = "Ortho On/Off". value = "5" . disable slider . } } } } //end text //define more text //some more text //end text //end paragraph //end row //end dialog And now the AutoLISP coding : (defun C:samp7 () (setq lngth 50.not (exit) ).} : text_part { label = "by Kenny Ramage".setq (start_image "im") (fill_image 0 0 w h 5) (end_image) (start_list "selections") (mapcar 'add_list NAMES) (end_list) (set_tile "eb1" "50") (mode_tile "eb1" 1) (mode_tile "myslider" 1) (setq orth (itoa (getvar "orthomode"))) (set_tile "tog1" orth) (setq sna (itoa (getvar "snapmode"))) (set_tile "tog2" sna) .start the list box .put dat into edit box .*get orthomode value .*switch toggle on or off .load dialog .*get snap value .get image tile width .if (setq w (dimx_tile "im") h (dimy_tile "im") ).preset hole type .end list .preset hole size .disable edit box .*switch toggle on or off .dcl")) (if (not (new_dialog "samp7" dcl_id) ).test for dialog .define list .0) (setq hole "site") (setq siz "M20") (setq NAMES '("M6" "M8" "M10" "M12" "M16" "M20" "M24" "M30") ).get image tile height .fill the list box .fill it with blue .preset slot length .define function .start the image .exit if no dialog .setq (setq dcl_id (load_dialog "samp7.end image . store hole type .store hole type .if userclick .if O.close dialog.progn ).if user moves slider .store hole type .close dialog.(action_tile "myslider" "(slider_action $value $reason)") slider_action (action_tile "eb1" "(ebox_action $value $reason)") ebox_action (defun slider_action (val why) (if (or (= why 2) (= why 1)) (set_tile "eb1" val))) (defun ebox_action (val why) (if (or (= why 2) (= why 1)) (set_tile "myslider" val))) (action_tile "tog1" "(setq orth $value)") (action_tile "tog2" "(setq sna $value)") (action_tile (action_tile (action_tile (action_tile (action_tile (action_tile "rb1" "rb2" "rb3" "rb4" "rb5" "rb6" "(setq hole "(setq hole "(setq hole "(setq hole "(setq hole "(setq hole (mode_tile (mode_tile (mode_tile \"site\")") \"shop\")") \"hid\")") \"ctsk\")") \"elev\")") \"slot\") \"eb1\" 0) \"myslider\" 0) \"eb1\" 2)") .K.unload .store hole type .switch focus to edit box (action_tile "cancel" "(done_dialog) (setq userclick nil)" ).start dialog .pass arguments to .is user enters slot length .*get ortho toggle value .enable slider . set flag .update slider .*get snap toggle value .get the size .check values . set flag .*snap on/off .action tile (start_dialog) (unload_dialog dcl_id) (if userclick (progn (setq SIZ (fix SIZ)) (setq SIZ (nth SIZ NAMES)) ).update edit box .define function .action_tile (action_tile "accept" (strcat "(progn (setq SIZ (atof (get_tile \"selections\")))" "(setq lngth (atof (get_tile \"eb1\")))" "(setvar \"orthomode\" (atoi orth))" "(setvar \"snapmode\" (atoi sna))" " (done_dialog)(setq userclick T))" ). pressed .check O.*ortho on/off .get slot length .if cancel button pressed .check values .K.strcat ).convert to integer . was selected .string 'em together .store hole type .define function .store hole type .pass arguments to .enable edit box .get list selection . (princ) ).defun C:samp (princ) . label = "Bolt Holes &Site" . : row { :boxed_radio_column { label = "Type" . label = "Bolt Holes &Hidden" . : radio_button { key = "rb1" . } : radio_button { key = "rb3" .To finish off the box. } : radio_button { key = "rb2" . The Complete DCL coding : samp8 : dialog { label = "Structural Holes" . label = "Bolt Holes Sho&p" . } : radio_button { key = "rb4" . we'll add an Edit Box so that the user can include some notes. if he so wishes. value = "1" . } //dialog name //give it a label //define row //define radio column //give it a label //define radion button //give it a name //give it a label //switch it on //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition //define radio button //give it a name //give it a label //end definition . label = "Bolt Holes &Ctsnk" . : radio_button { key = "rb5" . } } : boxed_column { label = "&Size". value = "50". label = "Bolt Holes &Elevation" . label = "Notes :" . } } } : edit_box { key = "eb1" . edit_width = 6 . } :toggle { key = "tog2". } : radio_button { key = "rb6" . edit_width = 30 . } } : edit_box { key = "eb2" . } :boxed_row { :toggle { key = "tog1". } ok_cancel . label = "Ortho On/Off". max_value = 100. label = "Snap On/Off". label = "Slot &Length (O/All Slot)" . value = "5" . : popup_list { key = "selections". //define radio button //give it a name //give it a label //end definition //define radion button //give it a name //give it a label //end definition //end radio column //define boxed column //give it a label //define popup list //give it a name //initial value //end list //end boxed column //end row //define edit box //give it a name //give it a label //6 characters only //end edit box //defin slider //give it a name //upper value //lower value //initial value //end slider //define boxed row //define toggle //give it a name //give it a label //end toggle //define toggle //give it a name //give it a label //end definition //end boxed row //*define edit box //*give it a name //*give it a label //*30 characters //*end edit box //predifined OK/Cancel . } : slider { key = "myslider" . min_value = 0. label = "Bolt Holes &Slotted" . } } } } //define row //define image tile //give it a name //and a height //and now a width //end image //define paragraph //define text //give it some text //end text //define more text //some more text //end text //end paragraph //end row //end dialog And Now the Complete AutoLISP coding : (defun C:samp8 () (setq lngth 50.test for dialog .0 .get image tile width .dcl")) (if (not (new_dialog "samp8" dcl_id) ).end image . width = 1.get image tile height .define function .start the list box . height = 1. } : paragraph { : text_part { label = "Designed and Created".start the image .setq (start_image "im") (fill_image 0 0 w h 5) (end_image) (start_list "selections") .0) (setq hole "site") (setq siz "M20") (setq NAMES '("M6" "M8" "M10" "M12" "M16" "M20" "M24" "M30") ).preset hole size .preset slot length .exit if no dialog .0 .: row { : image { key = "im" .fill it with blue .preset hole type . } : text_part { label = "by Kenny Ramage".if (setq w (dimx_tile "im") h (dimy_tile "im") ).define list .load dialog .setq (setq dcl_id (load_dialog "samp8.not (exit) ). define function .check values .store hole type .disable edit box .enable edit box .if user moves slider .get list selection .get slot length .get snap toggle value .store hole type . set flag .define function .action tile .switch toggle on or off .update slider . set flag .K.get ortho toggle value .get snap value .if O.(mapcar 'add_list NAMES) (end_list) (set_tile "eb1" "50") (mode_tile "eb1" 1) (mode_tile "myslider" 1) (setq orth (itoa (getvar "orthomode"))) (set_tile "tog1" orth) (setq sna (itoa (getvar "snapmode"))) (set_tile "tog2" sna) (action_tile "myslider" "(slider_action $value $reason)") slider_action (action_tile "eb1" "(ebox_action $value $reason)") ebox_action (defun slider_action (val why) (if (or (= why 2) (= why 1)) (set_tile "eb1" val))) (defun ebox_action (val why) (if (or (= why 2) (= why 1)) (set_tile "myslider" val))) (action_tile "tog1" "(setq orth $value)") (action_tile "tog2" "(setq sna $value)") (action_tile (action_tile (action_tile (action_tile (action_tile (action_tile "rb1" "rb2" "rb3" "rb4" "rb5" "rb6" "(setq hole "(setq hole "(setq hole "(setq hole "(setq hole "(setq hole (mode_tile (mode_tile (mode_tile \"site\")") \"shop\")") \"hid\")") \"ctsk\")") \"elev\")") \"slot\") \"eb1\" 0) \"myslider\" 0) \"eb1\" 2)") .strcat ).end list .snap on/off .get orthomode value .if cancel button pressed .fill the list box .action_tile (action_tile "accept" (strcat "(progn (setq SIZ (atof (get_tile \"selections\")))" "(setq lngth (atof (get_tile \"eb1\")))" "(setq notes (get_tile \"eb2\"))" "(setvar \"orthomode\" (atoi orth))" "(setvar \"snapmode\" (atoi sna))" " (done_dialog)(setq userclick T))" ).pass arguments to .switch focus to edit box (action_tile "cancel" "(done_dialog) (setq userclick nil)" ).store hole type .store hole type .store hole type .string 'em together .update edit box .put dat into edit box . pressed .close dialog.switch toggle on or off .enable slider .disable slider .check values .close dialog.store hole type .pass arguments to .ortho on/off .*get notes .is user enters slot length . .defun C:samp (princ) ... so that you can check their values at the command line..get the size I have deliberately left all variables local..K.. .(start_dialog) (unload_dialog dcl_id) (if userclick (progn (setq SIZ (fix SIZ)) (setq SIZ (nth SIZ NAMES)) ).convert to integer .. was selected ...check O..start dialog . That's it Folks..if userclick (princ) )..Enjoy your Dialog Boxes.progn ).unload . 64.9. (It's the rest that's a pain).55.4.8.5.146.3.8.6. This is when Visual Basic comes into its own.DAT containing the following : **UNIVERSAL BEAMS DATA **----------------------**H X B X T1 X T2 X R1 **----------------------*100x55x8 100. Creating Dialog Boxes using VB is a pure pleasure.6 *203x133x30 206.) The second line contains the physical dimensions that we need to draw the beam.7.0 *180x91x19 180.6 *254x146x43 259. width. Create a file named BEAM.0 *200x100x22 200.12.0.0.4.8.1.4.6.6 *254x146x31 251.8.0.91.5.0.6.9. Name this file BEAM.82.0.8. (100.7.5.0.147.10.7.1. Dialog boxes.8.5.0 *120x64x10 120. (Pure Magic!!) This is a complete working example of parametric programming.7. The user will select the size of beam from a list in a dialog box.0.1.4.6.133. The coding is below : . Anyway.4.7.4.6. flange thickness and root radius.1.146.6.3.0.0.DCL. lets start by writing the data file.6 *305x102x25 **------------------------The first line (*100x55x8) is the name of the beam.7.Dialog Boxes in Action So here we are.3.12. (100 deep x 50 wide x 8 kg/m beam.4.7.9.7. web thickness.7.0.0.6.3.7.7.7. First.0 *140x73x13 140.7.100.5. The data for the beam will then be retrieved from an external data file.5.3. We will then draw the beam without touching our mouse or keyboard.) Next we need to write our DCL (Dialog Control Language) file.0 *203x133x25 203.0. I digress.6.5.2.9.0) (Height. so stuff the torpedoes and full steam ahead.7.7.0 *160x82x16 160.5.9.55.7. the bane of all AutoLispers! I must say they are quite a pain in the backside.4.4.0.0.6 *254x146x37 256. In this tutorial we are going to try to write a program that draws structural steel beams.8.133.0.6.0.73.0. Allow_accept ..This is the key that Autolisp uses to refer to the list.defun . (brantea!!) What! Back already? O.. This is the wording that you see at the top of the box when it is displayed. here we go : (defun DTR (a) (* pi (/ a 180. key = "selections". } ok_cancel . } } //dialog name //dialog label //list box //list box label //key to list //height //allow double clicking //OK and Cancel Buttons //Text Label //Text Label As you can see.*================================================================= . Height . this is the name that AutoLisp knows the box by.Simply the height of the box.K. height = 12. DCL is very similar to AutoLISP in that what you open. Thank You notes to me. :text_part { label = "Designed and Created". (Refer to the AutoCAD Customisation Manual for more examples of these.Wording that is displayed above the list box. you must close. The third line displays a list box. The second line is the label attribute. Remember. The next section displays pre-constructed OK and Cancel buttons.beam : dialog { label = "Beams. Tel. : list_box { label = "&Choose Section :". allow_accept = true .". Time for the AutoLisp Coding. Number. the first line is simply the name of the dialog box.) The last section is were you put your name. E-Mail address. Take note of were the { and } occur. If your list exceeds the height of the list box vertical scroll bars are added. Ready.Instead of selecting an item from the list and then the OK button. } :text_part { label = "by Kenny Ramage". etc.0)) ). this allows you to select by double-clicking the list item. Now let us try and tie this lot together. A key attribute . This has it's own attributes : A label attribute .K Time for a rest and a cup of tea. O.convert to radians . .list of names ).*Initialise and Setup Dialog Box .if not exit ).store system variables OLDBLIP (getvar "BLIPMODE") OLDSNAP (getvar "OSMODE") ).load into memory ).close dialog and set flag )..get size of beam "(done_dialog) (setq userclick1 T))" ..continue with programme (setq SIZA (fix SIZA)) .if OK or double click (strcat "(progn (setq SIZA (atof (get_tile \"selections\")))" .end list box (action_tile "cancel" .add names from list (end_list) .strcat ).*====================================================== . set flag ).initialise dialog box (if (not .function defined (setq OLDECHO (getvar "CMDECHO") .if (if dialogshow .if dialog (progn .start list box (mapcar 'add_list NAMES) .retrieve name from list .dat") ..if OK or double click (progn .*This section is covered in the External Data Tutor .close dialog.if cancel selected "(done_dialog) (setq userclick1 nil)" .not (setq dialogshow nil) .check dcl exists (new_dialog "beam" dcl_id) ..action tile (action_tile "accept" .continue with programme (start_list "selections") .action tile (start_dialog) .*Retrieve Data from External Data File .convert index to integer (setq SIZA (nth SIZA NAMES)) ..unload dialog (if userclick1 .display dialog (unload_dialog dcl_id) .(defun C:BEAM (/) .setq (setq dialogshow T) .set flag (setq dcl_id (load_dialog "beam.setq (setvar "CMDECHO" 0) (setvar "BLIPMODE" 0) (setq NAMES '("100x55x8" "120x64x10" "140x73x13" "160x82x16" "180x91x19" "200x100x22" "203x133x25" "203x133x30" "254x146x31" "254x146x37" "254x146x43").dcl")) ..*====================================================== (setq dlist nil size (strcat "*" SIZA) file (findfile "beam.... 0) R1) P4 (polar P3 0 R1) P5 (polar P4 0 (/ (. .setq ).B (+ T1 R1 R1)) 2)) ..*Format List (if data (progn (setq maxs (strlen data) count 1 chrct 1 ).setq (while item (if (= item size) (setq data (read-line fp) item nil ).count chrct)))) dlist (append dlist (list numb)) ).*This routine draws the beam.*======================================================== (mapcar 'set '(H B T1 T2 R1) dlist) (setq OLDSNAP (getvar "OSMODE")) (while (setq IP (getpoint "\nInsertion Point: ")) (setvar "OSMODE" 0) (setq P1 (polar IP 0 (/ T1 2)) P2 (polar P1 (DTR 90....*This section is covered in the Calculating Points Tutor .progn ).setq (setq item (read-line fp)) ).*======================================================== .fp item (open file "r") (read-line fp) ).count chrct)) chrct)) dlist (append dlist (list numb)) chrct 1 )..while .if data (close fp) ...if (setq count (1+ count)) ).0) (/ (.if )." (substr data count 1)) (setq chrct (1+ chrct)) (setq numb (atof (substr data (1+ (..setq )..while (setq numb (atof (substr data (1+ (.setq (while (< count maxs) (if (/= "..H (+ T2 T2 R1 R1)) 2)) P3 (polar P2 (DTR 90. 0) B) P7 (DTR 270.0) R1) 2)) T2 R1 R1))) T1 R1 R1)) 2)) T1 R1 R1)) 2)) ).command (prompt "\nRotation Angle: ") (command "ROTATE" "LAST" "" IP pause ).defun BEAM Phew. First.command (setvar "OSMODE" OLDSNAP) )..0) (.0) R1) P13 (DTR 180. If everything is OK we call start_list.0" P2 "ARC" P4 "LINE" P5 P6 P7 P8 P9 "ARC" P11 "LINE" P12 "ARC" P14 "LINE" P15 P16 P17 P18 P19 "ARC" P21 "LINE" P1 "" ).0) (/ (. setting up error checking to make sure that the dialog file is loaded before continuing..0) (/ (.0" "0.0) T2) P8 0 (/ (.B (+ P15 (DTR 270.if userclick1 ).progn ).B (+ T1 R1 R1)) P9 0 R1) P10 (DTR 270.H (+ T2 P12 (DTR 270. quite a mouthfull hey.P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20 P21 (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar (polar P5 (DTR 90. (I have deliberatively left all variables global so that you can check their values once the programme has run.) After storing then resetting some of our system variables we create a list of names that will appear in our list box. Following this we load our dialog box.0) T2) P6 (DTR 180.0) R1) P20 (DTR 90. Here the MAPCAR function is useful for turning a raw AutoLisp list into a listbox display : . we define our degrees to radians function.0) R1) P11 (DTR 270. Let's walk through it. We then start defining our main function and declaring our variables.progn ).setq (command "PLINE" P1 "W" "0.0) R1) P14 (DTR 180. add_list and end_list to create our list box.0) T2) P16 0 B) P17 (DTR 90.B (+ P19 (DTR 180.0) T2) P18 (DTR 180.while ).if dialogshow (setvar "OSMODE" OLDSNAP) (setvar "BLIPMODE" OLDBLIP) (setvar "CMDECHO" OLDECHO) (princ) ). It terminates the dialog box. At that time the tile passes the string back to AutoLisp.strcat ).action tile .if OK or double click (strcat "(progn (setq SIZA (atof (get_tile \"selections\")))" . Lets look at another code fragment. set flag Did you notice all the quotes around the lisp code? When you write an action_tile function for a DCL tile. (NAMES) (end_list) The value returned by a list box tile is the INDEX of the selected item. . etc. It assigns a value of T to the variable userclick1. third item = 2 .if cancel selected . On it's own a DCL definition does nothing more than define a lifeless dialog box.e. (KEY) (mapcar 'add_list NAMES) .close dialog and set flag ). Now that everything is set and ready to go. AutoLisp then converts the string to functioning code and the code is executed. your code is esentially telling the tile : "Remember this string.action tile When the user selects the OK button. the lengthy string assigned to the button is passed-back and turned into AutoLisp code that looks like this : (progn (setq SIZA (atof (get_tile "selections"))) (done_dialog) (setq userclick1 T) ).e Anything within double-quotation marks) is dormant until the user picks the tile that is remembering your string. (i. second item = 1 .) The action_tile function is one of the most critical functions to employ when giving your dialog box some functionality.Specify the list.get size of beam "(done_dialog) (setq userclick1 T))" . Take a look at the following code : (action_tile "cancel" "(done_dialog) (setq userclick1 nil)" )." The string (i.Specify name of the list box. we invoke the dialog box. first item = 0 . This code does several things : It retrieves the value of the INDEX from the list box.(start_list "selections") . then pass it back to me when the user activates you.close dialog. The following is the action_tile expression assigned to the OK button : (action_tile "accept" . until the user hits OK. (This is basically self explanatory. it controls the programme flow. (mapcar 'set '(H B T1 T2 R1) dlist) The points required to draw the beam are then calculated using the POLAR function and the beam is drawn and rotated if required. (setq SIZA (nth SIZA NAMES)). It then searches the data file for the corresponding name.) The program retrieves the name of the item selected from the list box by utilising the index (SIZA) of the selected item and the nth function. For the rest of the program we are back to conventional AutoLisp code. retrieves the list of dimensions.(start_dialog) Once it is on the screen. Cancel or doubleclicks on an item in the list box. formats the list then stores the dimensions into individual variables. identical beams. especially if you have studied my earlier tutorials. . This saves him from having to re-run the entire routine again and again if he wants to draw multiple. (unload_dialog dcl_id) The user has made his selection so now we can unload the dialog box. Notice how this section of the coding is contained in a while loop to allow the user to draw more than one beam if he wishes. AutoCAD states that there is a limit of no more than eight nested dialog boxes allowed. : column { : text { key = "txt1". To nest dialog boxes is pretty straightforward.". You must close the nested dialog first. value = "This is the main dialog box. would have it's own dialog statements. but recommends a maximum of four. I haven't!!!) Thirdly. nested dialog box from within an action expression or callback function. First the DCL Coding: main : dialog { label = "Main Dialog". This is another area that seems to cause a lot of confusion for some people.Nesting Dialog Boxes. Just a couple of comments on nesting dialog boxes. you cannot use the previous dialog box whilst a nested dialog is active. Let's take a slow walk through the process of nesting and hiding dialog boxes and see if we can't explain it more clearly. then run the function (nextfunction). try and keep each nested dialog smaller than the preceding dialog. And secondly. (nextfunction). For example : (action_tile "next" "(nextfunction)") This simply says that when the tile with the key of 'next' is selected. (Try it. } . of course. You simply call the new. Firstly. Here's an example of a function with a main dialog box and two nested dialog boxes. .: text { key = "txt2". } : button { label = "OK". } } : row { : spacer { width = 1. fixed_width = true. width = 12.} } } //////////////////////////////////////////////// nest1 : dialog { . } : button { label = "Cancel". key = "cancel".". fixed_width = true. mnemonic = "C". nested dialog. width = 12. mnemonic = "O". mnemonic = "N". width = 12. value = "To display the next. is_cancel = true. key = "accept". } : button { label = "Next". fixed_width = true. key = "next".. value = "Press Next. } : spacer { width = 1.. } : text { key = "txt3".". is_default = true. press Next". width = 12. mnemonic = "C".label = "1st Nested Dialog". } : spacer { width = 1. } : text { key = "txt2". width = 12. key = "next".". fixed_width = true. nested dialog. fixed_width = true. : column { : text { key = "txt1". value = "To display the next. value = "This is the first nested dialog box. } : button { label = "Next". is_default = true. fixed_width = true. } : button { label = "OK". mnemonic = "N". width = 12. mnemonic = "O".} } } //////////////////////////////////////////////// . key = "accept". } } : row { : spacer { width = 1. is_cancel = true. } : button { label = "Cancel". key = "cancel". } } : row { : spacer { width = 1. is_cancel = true. key = "accept".load the DCL file . width = 12. is_default = true. fixed_width = true. } : spacer { width = 1.".define the function (setq dcl_id (load_dialog "nest. mnemonic = "O".} } } //////////////////////////////////////////////// And now the Autolisp Coding: (defun c:nest () . key = "cancel".dcl")) . fixed_width = true. value = "This is the last nested dialog box. } : button { label = "Cancel". width = 12. mnemonic = "C".nest2 : dialog { label = "2nd Nested Dialog". : column { : text { key = "txt1". } : button { label = "OK". ........define the function (setq dcl_id1 (load_dialog "nest.... (defun nest1 () ..(if (not (new_dialog "main" dcl_id)) ...load the nested dialog box .load the dialog box (exit) .if Next button is selected...start the dialog (unload_dialog dcl_id) ......if not loaded exit ) (action_tile "cancel" "(done_dialog) (setq result nil)" ) ..do this if Cancel button selected (action_tile "accept" "(done_dialog) (setq result T)" ) .. call ..load the DCL file (if (not (new_dialog "nest1" dcl_id1)) .....the nested dialog function (start_dialog) ....defun .do this if OK button selected (action_tile "next" "(nest1)" ) ....dcl")) ....................unload the dialog (princ) ). ........if not found exit ..... (defun nest2 () ......second nested dialog function (start_dialog) ..load the DCL file (if (not (new_dialog "nest2" dcl_id2)) ..defun ....(exit) ..if Next selected call the .start the nested dialog box (unload_dialog dcl_id1) ......unload the nested dialog box (princ) )............define the function (setq dcl_id2 (load_dialog "nest....dcl")) ....if OK selected do this (action_tile "next" "(nest2)" ) ....if cancel selected do this (action_tile "accept" "(done_dialog) (setq result1 T)" ) ...load the second nested dialog box (exit) ...if not loaded exit ) (action_tile "cancel" "(done_dialog) (setq result1 nil)" ) .. .defun .) (action_tile "cancel" "(done_dialog) (setq result2 nil)" ) ......... pretty simple..start the second nested dialog box (unload_dialog dcl_id2) ......... I'm waiting....Hiding Dialog Boxes!!! (Sorry......unload it (princ) ).............. what you have all been waiting for....... but you will have to go to the next page......do this if OK selected (start_dialog) .load clean See....) Hurry up.... hey.. (princ)..do this if Cancel selected (action_tile "accept" "(done_dialog) (setq result2 T)" ) ..... Now... If the user choosers the pick point button the dialog is hidden to allow the user to pick a point on the screen. Below is a sample routine that should. it returns the (done_dialog) status value. . But did you know that when you call the (done_dialog) function a status argument is returned? Well it's true!!! Now think about this. to do this. But. It also allows the user to enter the point values directly into the edit boxes if he so wishes. Often you need to make a selection on the screen whilst a dialog box is active. The dialog is then re-displayed and the x. it returns a status of 0. But how do I retrieve that status argument? Easy. eg. When you end a dialog box you use the (done_dialog) function. explain it to you a lot better. First the DCL Coding: hidebox : dialog { label = "Hide Dialog". : boxed_column { label = "Sample Point". hopefully. (setq flag (start_dialog). if you use the (done_dialog) function alongwith a status argument of say 4. when you call (start_dialog). along with the values that the user has selected. You must then restore the dialog box. If a tile who's key is 'accept' is choosen (The OK button). By testing this value in a loop we can determine whether the dialog was simply hidden or ended or cancelled. When (done_dialog) is called from a tile who's key is 'cancel' (The Cancel button). This routine simply displays a dialog box that asks the user for a point.Hiding Dialog Boxes. you need to be able to hide the dialog box to allow the user to make a selection from the screen. So. y and z edit boxes are updated to the new point value. it returns a status of 1. you know that the dialog box has been hidden and not ended or cancelled. I hope and pray. y.setq . } } ok_cancel. fixed_width = true.000" flag 4 ). fixed_width = true. } And now the AutoCAD Coding: (defun c:hidebox () .: button { label = "Pick Point <". } : edit_box { key = "eb3". label = "&Y:". mnemonic = "P". fixed_width = true.000" ptz "0. label = "&Z:". and z values . } : edit_box { key = "eb1". width = 8.and set flag to 4 . width = 8. fixed_width = true. label = "&X:".define the function (setq ptx "1. } : edit_box { key = "eb2". width = 8. key = "hide". width = 12.000" pty "0.set default x. close . get the edit box .check the flag status and carry on looping .set focus to x edit box (mode_tile "eb1" 3) .dcl")) .point values.display z value (mode_tile "eb1" 2) . This action sets the .load the DCL file (while (> flag 2) .the dialog.if not loaded exit ) (set_tile "eb1" ptx) .(setq dcl_id (load_dialog "hidebox.load the dialog box (exit) .if Cancel button selected. (action_tile "accept" "(setq ptx (get_tile \"eb1\")) (setq pty (get_tile \"eb2\")) (setq ptz (get_tile \"eb3\")) (done_dialog) (setq result T)" ) .if it is greater than 2 (if (not (new_dialog "hidebox" dcl_id)) .if OK button was selected.display y value (set_tile "eb3" ptz) .flag to 0. close the dialog. This action .sets the flag to 1.select contents (action_tile "cancel" "(done_dialog) (setq result nil)" ) . .display x value (set_tile "eb2" pty) . .if the pick button was selected (progn ..get the y value (setq ptz (rtos (caddr selpoint) 2 4)) ..if pick button selected..........get the z value ).... (princ)...defun ......do the following (setq selpoint (getpoint "\nInsertion Point: ")) ..unload the dialog (princ) )...get the insertion point (setq ptx (rtos (car selpoint) 2 4)) .start the dialog and set flag .if )......get the x value (setq pty (rtos (cadr selpoint) 2 4)) ..while (unload_dialog dcl_id) ..... hide the dialog ..and set the flag to 4 (setq flag (start_dialog)) ......(action_tile "hide" "(done_dialog 4)" ) ........load clean ...to value of start dialog (if (= flag 4) ..progn )... (I'll leave that up to you to figure out..To hide AND nest dialog boxes is just a case of combining the two...) . and absolutely no regard for my own safety. When (done_dialog) is called from a tile who's key is 'cancel' (the Cancel button). or (and this is more likely) gives up and joins a monastery/nunnery. along with the values that the user has selected. But how do I retrieve that status value? Easy. The meaning of any status value greater than 1 is determined by your application. If a tile who's key is 'accept' is chosen (the OK button). it will return a status value of 1. wuddly little bottom? The let's do it!!! ("Randall. whose meaning is determined by the application. Usage Notes : An explicit AutoLisp action for the "accept" button must specify a status of 1 (or an application-defined value).Hiding Dialog Boxes in DCL Ladies and Gentlemen "WASSUP" Hee. could you please keep the noise down 'cos I'm trying to explain something here.. (setq flag (start_dialogue)) .I know it's chicken and you're allowed to use your fingers. 0 if the user presses Cancel.. You must then restore the dialog box. but you're supposed to cook the thing and remove the feathers first. otherwise.. Often you need to make a selection on the screen whilst a dialog box is active. hee . (start_dialog) returns this value. 0. you know that the dialog box has been hidden and not ended or cancelled. YOU must define a status of 1. is in regards to hiding dialog boxes... If (done_dialog) is passed an integer status greater than 1. it returns a status of 0.. are you ready? Are you sat nice and comfy on your cuddly. Now here's the important bit. (start_dialog) returns the default value. The default value is 1 if the user presses OK. when you call (start_dialog). without further due.. you call the (done_dialog) function.. So.. which makes it appear as if the dialog box was canceled. you need to be able to hide the dialog box to allow the user to make a selection from the screen. if you use the (done_dialog) function along with a status value of say 4.") On to the more serious bit. it returns the (done_dialog) status value.I've always wanted to do that. What the heck does all this mean???? When you want to close a dialog. Note carefully. To accomplish this lets first have a look at two of the most critical DCL functions : (done_dialog [status]) status : A positive integer that (start_dialog) will return instead of returning 1 for OK or 0 for Cancel. (start_dialog) Return Values : The (start_dialog) function returns the optional status passed to (done_dialog). I'm going to have another shot at explaining how to go about hiding such a wee delicate thing as a dialog box. Probably the most vexing (on my part) query I get.. It seems to take ages and numerous emails before the poor soul trying to grasp the concept finally understands the principle. What? You're eating!! Try and use a knife and and fork . or -1 if all dialog boxes are terminated with (term_dialog). But did you know that when you call the (done_dialog) function a status argument is returned? Well it's true!!! Now think about this. Okay. But to do this.. un-hidden. : button { label = "Hide Dialog >>".} ok_cancel. alignment = centered.DCL And now the AutoLisp coding. key = "hide". the dialog is hidden and an alert box is displayed informing you of the fact. First the DCL Coding : hidedialog1 : dialog { label = "Hide Dialogue". explain it to you a lot better. This routine simply displays a dialog box with three buttons If you select "OK" or "Cancel". } : spacer { width = 1. hopefully. if you click the "Select Object" button. an alert box is displayed and the dialog is simply closed. Below is a sample routine that should. to use the words of a great magician that I once knew.LSP : . After selecting OK. is_default = true. fixed_width = true. I hope and pray. mnemonic = "H". the dialog is re-displayed or. Save this as "HideDialog1. } Save this as "HideDialog1. But. width = 8.By testing this value in a (while) loop we can determine whether the dialog was simply hidden or accepted or cancelled. set flag to 4 (setq flag 4) .if the OK button was selected (if (= flag 1) (alert "You chose the OK button")) .if pick button selected.if it is greater than 2 (while (> flag 2) .if Cancel button selected. (action_tile "cancel" "(done_dialog 0)") . close .if the Cancel button was selected (if (= flag 0) (alert "You chose the Cancel button")) .and set the flag to 4 (action_tile "hide" "(done_dialog 4)") .tiles.dcl")) .the dialog.load the dialog box (if (not (new_dialog "hidedialog1" dcl_id)) . close .if OK button was selected.to value of start dialog (setq flag (start_dialog)) .while .check the flag status and carry on looping .(defun c:hidedialog1 ( / dcl_id flag) .return value for the "cancel" "accept" and "hide" . I recommend you do the same.load the DCL file (setq dcl_id (load_dialog "hidedialog1.sets the flag to 1. This action .start the dialog and set flag . . This action sets the . (action_tile "accept" "(done_dialog 1)") .Note: I have explicitly defined the status .flag to 0.if the pick button was selected (if (= flag 4) (alert "You chose the Hide Dialog button")) ).if not loaded exit (exit)) . the dialog. hide the dialog . ........ (princ)........................load clean Let's now get really brave and have a look at a wee practical example......defun .unload the dialog (unload_dialog dcl_id) (princ) )................... ....................... : list_box { label = "&Properties :". alignment = centered. Okay. Once selected. We also want to be able to continue selecting objects which means that the dialog must update after each selection. width = 8. } : button { label = "Select Object >>". mnemonic = "S". fixed_width = true. let's give it a go. First the DCL Coding : hidedialog : dialog { label = "Hide Dialogue". key = "hide".We will now attempt to design a dialog box that will displays certain properties of a selected entity. key = "selections".} ok_cancel. We would like the dialog to display first. height = 7. } : spacer { width = 1. width = 25. the dialog will be updated with the objects property values. } . and then hide itself whilst we go about making up our mind which object we want to select. is_default = true. close .set flag to 4 (setq flag 4) .DCL And now the AutoLisp coding.flag to 0. (action_tile "cancel" "(done_dialog 0)") . (action_tile "accept" "(done_dialog 1)") .if it is greater than 2 (while (> flag 2) .LSP : (defun c:hidedialog ( / dcl_id thelist lay col ltp lwt flag) (vl-load-com) .if not loaded exit (exit)) .populate the list box with the values .load the DCL file (setq dcl_id (load_dialog "hidedialog.check the flag status and carry on looping . hide the dialog . Save this as "HideDialog. This action . close .the dialog.and set the flag to 4 (action_tile "hide" "(done_dialog 4)") .if pick button selected. This action sets the .if Cancel button selected.load the dialog box (if (not (new_dialog "hidedialog" dcl_id)) .set up default list box values (setq thelist '("Layer = NULL" "Color = NULL" "Linetype = NULL" "Lineweight = NULL")) .sets the flag to 1.dcl")) . the dialog.Save this as "HideDialog.in thelist (start_list "selections") (mapcar 'add_list thelist) (end_list) .if OK button was selected. next the linetype ltp (strcat "Linetype = " (vla-get-linetype ent)) .get the properties and place them in a list .the layer first (setq lay (strcat "Layer = " (vla-get-layer ent)) .if the pick button was selected (if (= flag 4) .setq ).if the Cancel button was selected (if (= flag 0) (alert "You chose the Cancel button")) .convert to vl object (setq ent (vlax-Ename->Vla-Object (car ent))) .progn ).if ).select the object (setq ent (entsel)) .start the dialog and set flag ..to value of start dialog (setq flag (start_dialog)) .create the list thelist (list lay col ltp lwt) ).finally the lineweight lwt (strcat "Lineweight = " (itoa (vla-get-lineweight ent))) .while .do the following (progn .if the OK button was selected (if (= flag 1) (alert "You chose the OK button")) .then the color col (strcat "Color = " (itoa (vla-get-color ent))) . . enjoyed the snacks (especially the chicken) and didn't drink too much beer......unload the dialog (unload_dialog dcl_id) (princ) ).... Remember....... don't drink and drive because you might spill some.... Well that's about it regarding hiding dialog boxes. (princ)...... .......load clean Hey just think! You can now design your own properties dialog.... I hope you had a good time..................defun ...... Syntax : (lspOkOnly "message1" "message2" "message3" "title") This message box returns nothing as it is used to convey a message only . It will display 5 different types of message boxes and allows you to enter 3 text message lines and customise the Message Box title.AutoLisp Message Box. This library of AutoLisp Functions closely emulates the Visual Basic Message Box Function. The message boxes available are : Ok Only Ok Cancel Rentry Cancel Yes No Yes No Cancel The syntax for usage is as follows: (function name "message1" "message2" "message3" "title") For example: (lspokcancel "This is the first line" "This is the second line" "This is the third line" "This is the title") Here is a detailed explanation of each message box: Ok Only. Syntax : (lspYesNo "message1" "message2" "message3" "title") This message box returns True if Yes selected and "F" if No selected .Ok Cancel. Syntax : (lspOkCancel "message1" "message2" "message3" "title") This message box returns True if OK selected and nil if Cancel selected Rentry Cancel. Syntax : (lspRentryCancel "message1" "message2" "message3" "title") This message box returns True if Rentry selected and nil if Cancel selected Yes No. Syntax : (lspYesNoCancel "message1" "message2" "message3" "title") This message box returns True if Yes selected. "F" if No selected and nil if Cancel selected. : column { : text { key = "message1". Here is the DCL Source Coding: lspOkCancel : dialog { key = "main". } : text { key = "message2". . } } : row { : spacer { width = 1. Source Coding.Yes No Cancel. key = "accept". } : button { label = "OK". fixed_width = true. } : text { key = "message3". width = 12. is_default = true. fixed_width = true. } : text { key = "message2". } : button { label = "Cancel". : column { : text { key = "message1". width = 12. } : button { label = "Yes". } } : row { : spacer { width = 1. } : spacer { width = 1. mnemonic = "Y".mnemonic = "O".} } } //////////////////////////////////////////////// lspYesNo : dialog { key = "main". is_cancel = true. key = "yes". } . } : text { key = "message3". width = 12. fixed_width = true. mnemonic = "C". key = "cancel". is_default = true. } : text { key = "message2". mnemonic = "N". } : spacer { width = 1. width = 12. : column { : text { key = "message1". } : button { label = "OK". is_default = true. is_cancel = true.} . } } : row { : spacer { width = 1. } : spacer { width = 1. mnemonic = "O".} } } //////////////////////////////////////////// lspOkOnly : dialog { key = "main". fixed_width = true. key = "accept". alignment = centered. key = "no". width = 12.: button { label = "No". fixed_width = true. } : text { key = "message3". } } //////////////////////////////////////////////// lspYesNoCancel : dialog { key = "main". is_default = true. } : button { label = "Cancel". . key = "no". width = 12. } : text { key = "message2". mnemonic = "Y". fixed_width = true. } } : row { : spacer { width = 1. mnemonic = "N". } : button { label = "Yes". width = 12. : column { : text { key = "message1". } : text { key = "message3". fixed_width = true. fixed_width = true. key = "cancel". } : button { label = "No". key = "yes". width = 12. is_default = true. : column { : text { key = "message1". key = "rentry". is_cancel = true. is_cancel = true. mnemonic = "R". } : spacer { width = 1. } : button { label = "Rentry". width = 12. fixed_width = true. width = 12. } } : row { : spacer { width = 1. } . mnemonic = "C". key = "Cancel".mnemonic = "C". } : button { label = "Cancel". } : text { key = "message3". fixed_width = true. } : text { key = "message2".} } } //////////////////////////////////////////// lspRentryCancel : dialog { key = "main". ............ (defun lspYesNo (message1 message2 message3 main) (setq dcl_id (load_dialog "msgbox...................: spacer { width = 1...........} } } //////////////////////////////////////////// And the Autolisp Code: (defun lspOkCancel (message1 message2 message3 main) (setq dcl_id (load_dialog "msgbox...........dcl")) (if (not (new_dialog "lspOkCancel" dcl_id)) (exit) ) (set_tile (set_tile (set_tile (set_tile "message1" message1) "message2" message2) "message3" message3) "main" main) (action_tile "cancel" "(done_dialog) (setq result nil)" ) (action_tile "accept" "(done_dialog) (setq result T)" ) (start_dialog) (unload_dialog dcl_id) (princ) ) ...dcl")) (if (not (new_dialog "lspYesNo" dcl_id)) (exit) ) (set_tile "message1" message1) (set_tile "message2" message2) .. ....dcl")) (if (not (new_dialog "lspOkOnly" dcl_id)) (exit) ) (set_tile (set_tile (set_tile (set_tile "message1" message1) "message2" message2) "message3" message3) "main" main) (action_tile "yes" "(done_dialog)" ) (start_dialog) (unload_dialog dcl_id) (princ) ) .............dcl")) (if (not (new_dialog "lspYesNoCancel" dcl_id)) (exit) ) .....(set_tile "message3" message3) (set_tile "main" main) (action_tile "no" "(done_dialog) (setq result \"F\")" ) (action_tile "yes" "(done_dialog) (setq result T)" ) (start_dialog) (unload_dialog dcl_id) (princ) ) ...................... (defun lspOkOnly (message1 message2 message3 main) (setq dcl_id (load_dialog "msgbox............ (defun lspYesNoCancel (message1 message2 message3 main) (setq dcl_id (load_dialog "msgbox....................................................... .. (defun lspRentryCancel (message1 message2 message3 main) (setq dcl_id (load_dialog "msgbox.....................................dcl")) (if (not (new_dialog "lspRentryCancel" dcl_id)) (exit) ) (set_tile (set_tile (set_tile (set_tile "message1" message1) "message2" message2) "message3" message3) "main" main) (action_tile "cancel" "(done_dialog) (setq result nil)" ) (action_tile "rentry" "(done_dialog) (setq result T)" ) .(set_tile (set_tile (set_tile (set_tile "message1" message1) "message2" message2) "message3" message3) "main" main) (action_tile "no" "(done_dialog) (setq result \"F\")" ) (action_tile "yes" "(done_dialog) (setq result T)" ) (action_tile "cancel" "(done_dialog) (setq result nil)" ) (start_dialog) (unload_dialog dcl_id) (princ) ) .............. ..............(start_dialog) (unload_dialog dcl_id) (princ) ) .................................... (princ) ..... To use this routine you feed the function 3 arguments. the Input Box above was called by using the following command: (inputbox "Enter Number" "AfraLisp Inputbox" "342. and the Default Value of the Edit Box. the Input Box Prompt.AutoLisp Input Box. The syntax is straightforward: (inputbox "prompt" "title" "default") For example. Source Coding. } ok_cancel. the Title of the Input Box. : text { key = "prompt". } : edit_box { key = "eb1". } And next the AutoLisp Coding: . This routine is very similar to the Visual Basic Input Box Function.34") The Input Box returns a variable "inputvalue" containing the value of the Edit Box. First the DCL Coding: inputbox : dialog { key = "title". ....dcl")) (if (not (new_dialog "inputbox" dcl_id)) (exit) ) (set_tile "prompt" prompt) (set_tile "title" title) (set_tile "eb1" default) (mode_tile "eb1" 2) (action_tile "cancel" "(done_dialog) (setq result nil)" ) (action_tile "accept" "(setq inputvalue (get_tile \"eb1\")) (done_dialog) (setq result T)" ) (start_dialog) (unload_dialog dcl_id) (princ) ) ....(defun inputbox (prompt title default) (setq dcl_id (load_dialog "inputbox........... (princ) ..................................... did you know that a DCL file can also use tiles defined in another DCL file by naming the other file in what is called an include directory.the dialog.dcl")) . } Now.load the dialog box (exit) . This file contains the DCL definitions for the basic. This file contains the standard definitions of all dialog boxes used by AutoCAD.Referencing DCL Files.Dcl in this directory. You will also find Acad. But.define the function (setq dcl_id (load_dialog "include1. If you look in your AutoCAD Support directory. First create a new DCL file called Include1.Lsp with the following coding: (defun c:include1 () .if Cancel button selected. . ok_cancel. create a new AutoLisp file entitled Include1.Dcl. Let me try and show you how this works. close .Dcl: include1 : dialog { label = "Choose a Point:". It also contains definitions for commonly used prototypes. you will find a file entitled Base.load the DCL file (if (not (new_dialog "include1" dcl_id)) .if not loaded exit ) (action_tile "cancel" "(done_dialog) (setq result nil)" ) . predefined tiles and tile types. ........unload the dialog (princ) )..(action_tile "accept" "(done_dialog) (setq result T)" ) ...load clean Open AutoCAD and load and run the routine.. You should have a very simple dialog box looking like this : Now.. (princ)..... By doing it this way.....if OK button was selected (start_dialog) ... if say our telephone number changes... But what happens..... and include this file in our original DCL file... let's say we had a company logo..defun . Let's create our logo DCL file first.... We would then have to edit all of our dialog boxes containing the DCL coding for our logo.. we only have to change the master DCL file if we want to make revisions to our logo.....start the dialog (unload_dialog dcl_id) .Dcl: atitle : boxed_column { : paragraph { ... Here's a better way......... or something like that. that we wanted to display on all our custom dialog boxes.. Create a new DCL file entitled Atitle. We will create another DCL file containing the DCL coding for our logo.. We could put the DCL coding for the logo in all our DCL files.. } : text_part { label = "063-235837". It should look like this: . } : text_part { label = "AfraLisp". atitle. } } } Now revise the coding of our original include1.dcl" include1 : dialog { label = "Choose a Point:". } : text_part { label = " You By". ok_cancel.Lsp.: text_part { label = "Brought To". } Re-Load and run Include1.dcl to look like this: @include "atitle. it's not the best looking logo I've ever seen. } : edit_box { key = "eb3". First create a new DCL file called gpoint.dcl. key = "hide". label = "&Z:". : button { label = "Pick Point <".dcl" include : dialog { . Let's have a look at another example.dcl" @include "atitle. label = "&X:". } : edit_box { key = "eb1". width = 8.K I agree. width = 8. Add this coding to it: gpoint : boxed_column { label = "Sample Point". } } Now create a new DCL file entitle Include. mnemonic = "P". fixed_width = true. width = 12. width = 8. label = "&Y:". fixed_width = true.O. fixed_width = true. but I'm sure you get the idea. } : edit_box { key = "eb2". fixed_width = true.Dcl and add this coding: @include "gpoint. You can even include two or more references to DCL Files if you wish. Lsp will look like this: (defun c:include () . ok_cancel.if not loaded exit ) (set_tile "eb1" ptx) .display z value (mode_tile "eb1" 2) .000" flag 4 ). gpoint. } The coding for your lisp file.display x value (set_tile "eb2" pty) .y.if it is greater than 2 (if (not (new_dialog "include" dcl_id)) .setq .define the function (setq ptx "1.and set flag to 4 (setq dcl_id (load_dialog "include.display y value (set_tile "eb3" ptz) .load the dialog box (exit) .dcl")) . and z values . atitle. called Include.000" pty "0.load the DCL file (while (> flag 2) .label = "Choose a Point:".set default x.check the flag status and carry on looping .000" ptz "0. get the x value (setq pty (rtos (cadr selpoint) 2 4)) .if Cancel button selected.set focus to x edit box (mode_tile "eb1" 3) .sets the flag to 1. This action .select contents (action_tile "cancel" "(done_dialog) (setq result nil)" ) . (action_tile "accept" "(setq ptx (get_tile \"eb1\")) (setq pty (get_tile \"eb2\")) (setq ptz (get_tile \"eb3\")) (done_dialog) (setq result T)" ) .get the insertion point (setq ptx (rtos (car selpoint) 2 4)) .the dialog. close .if the pick button was selected (progn . get the edit box .to value of start dialog (if (= flag 4) .do the following (setq selpoint (getpoint "\nInsertion Point: ")) . close the dialog. (action_tile "hide" "(done_dialog 4)" ) .if OK button was selected..point values.flag to 0.if pick button selected.start the dialog and set flag . hide the dialog . This action sets the .and set the flag to 4 (setq flag (start_dialog)) . .. you could create a whole library of DCL files containing customised dialog definitions which you could include/reference in all of your DCL files..........unload the dialog (princ) )........................defun ...if )....get the y value (setq ptz (rtos (caddr selpoint) 2 4)) ......load clean Your dialog box should look like this: If you wanted.....progn )..get the z value )..while (unload_dialog dcl_id) .. .. (princ)... . AutoCAD and DCL The AutoCAD PDB facility has a large set of built-in. tiles that can be used by themselves or as the basis for more complex tiles. . These tiles can be sub-divided into 5 main categories: Exit Buttons and Error Tiles. image text spacer spacer_0 spacer_1 Text Clusters. as well as the AutoLisp coding required to make the dialogue box tile functional.Functional Synopsis of DCL Tiles. In this tutorial we will have a look at each tile. button edit_box list_box popup_list radio_button toggle slider image_button Decorative and Informative Tiles. ok_only ok_cancel ok_cancel_help ok_cancel_help_errtile ok_cancel_help_info errtile Predefined Active Tiles. Many people have requested a listing of all of the available DCL tiles along with a working AutoLisp example of each tile. the DCL coding for it. or predefined. boxed_column boxed_radio_column boxed_radio_row boxed_row column dialog radio_column radio_row row .concatenation paragraph text_part Tile Clusters. test for dialog ).not (exit) . } //dialog name //give it a label //predefined OK button //end dialog AutoLisp Coding: (defun C:lisp48a () . Syntax: ok_only.load dialog (if (not (new_dialog "lisp48a" dcl_id) . The key of the OK button is 'accept'.if (action_tile . The ok_only tile is defined in the Base. DCL Coding: lisp48a : dialog { label = "ok_only" .define function (setq dcl_id (load_dialog "lisp48a. ok_only .Dcl file.ok_only.exit if no dialog ).dcl")) . if (princ) ).inform the user ). set flag ).start dialog (unload_dialog dcl_id) .") . pressed "(done_dialog) (setq userclick T)" .K."accept" .if O.close dialog.unload (if userclick .if OK selected (alert "You Choose O.action tile (start_dialog) .K.defun (princ) . DCL Coding: lisp48b : dialog { label = "ok_cancel" . The key of the OK button is 'accept'.not (exit) .dcl")) .load dialog (if (not (new_dialog "lisp48b" dcl_id) . ok_cancel . Syntax: ok_cancel. The key of the Cancel button is 'cancel'.define function (setq dcl_id (load_dialog "lisp48b.Dcl file. pressed .ok_cancel.if (action_tile "accept" . } //dialog name //give it a label //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48b () . The ok_cancel tile is defined in the Base.if O.test for dialog ).K.exit if no dialog ). lower flag ).action tile (action_tile "cancel" . set flag ).inform the user ).if cancel button pressed "(done_dialog) (setq userclick nil)" .if OK selected (alert "You selected OK") .close dialog.if (princ) ).start dialog (unload_dialog dcl_id) ."(done_dialog) (setq userclick T)" .close dialog.action_tile (start_dialog) .defun (princ) .unload (if userclick .inform the user (alert "You selected Cancel") . Dcl file.define function . The key of the Cancel button is 'cancel'. The ok_cancel_help tile is defined in the Base. //dialog name //give it a label //predefined OK/Cancel/Help //button //end dialog //dialog name //give it a label //define text //give it a label //end text //predefined OK Button //end dialog } gotohelp : dialog { label = "Help Box" . : text { label = "This is the Help Box" . } ok_only . The key of the OK button is 'accept'. ok_cancel_help. DCL Coding: lisp48c : dialog { label = "ok_cancel_help" . } AutoLisp Coding: (defun C:lisp48c () . Syntax: ok_cancel_help. The key of the Help button is 'help'.ok_cancel_help. dcl")) .not (exit) .exit if no dialog ).if (action_tile "accept" .action_tile (start_dialog) .call help function ). pressed "(done_dialog) (setq userclick T)" .K.action tile (action_tile "cancel" .if O.load dialog (if (not (new_dialog "lisp48c" dcl_id) .test for dialog ).(setq dcl_id (load_dialog "lisp48c.close dialog.if cancel button pressed "(done_dialog) (setq userclick nil)" .if OK selected (alert "You selected OK") . set flag ).unload (if userclick .if help button pressed "(gotohelp)" .inform the user (alert "You selected Cancel") .start dialog (unload_dialog dcl_id) . lower flag ).action_tile (action_tile "help" .close dialog. close dialog ).unload (princ) ).exit if no dialog )..not (exit) .action tile (start_dialog) .load dialog (if (not (new_dialog "gotohelp" dcl_id) .define function (setq dcl_id (load_dialog "lisp48c.inform the user ).defun (defun gotohelp () . pressed "(done_dialog)" .if (action_tile "accept" .test for dialog ).start dialog (unload_dialog dcl_id) .K.dcl")) .if (princ) ).if O.defun (princ) . The key of the Cancel button is 'cancel'. The key of the OK button is 'accept'. ok_cancel_help_errtile.Dcl file. //dialog name //give it a label //predefined OK/Cancel/Help/ //errtile button //end dialog //dialog name //give it a label //defin text //give it a label //end text //predefined OK Button //end dialog } gotohelp : dialog { label = "Help Box" . The key of the Error tile is 'error'. DCL Coding: lisp48d : dialog { label = "ok_cancel_help_errtile" . } ok_only .ok_cancel_help_errtile. Syntax: ok_cancel_help_errtile. : text { label = "This is the Help Box" . The ok_cancel_help_errtile tile is defined in the Base. The key of the Help button is 'help'. } AutoLisp Coding: (defun C:lisp48d () . if (action_tile "accept" .set_tile (start_dialog) .if O.call help function ).dcl")) .test for dialog ).close dialog.start dialog . lower flag ).action_tile (action_tile "help" .if there is an error "There has been an *Error*" . pressed "(done_dialog) (setq userclick T)" .close dialog.define function (setq dcl_id (load_dialog "lisp48d.if help button pressed "(gotohelp)" .action tile (action_tile "cancel" .load dialog (if (not (new_dialog "lisp48d" dcl_id) .action_tile (set_tile "error" .if cancel button pressed "(done_dialog) (setq userclick nil)" ..not (exit) .display this message ).K.exit if no dialog ). set flag ). if (action_tile "accept" .dcl")) .if OK selected (alert "You selected OK") .action tile (start_dialog) .(unload_dialog dcl_id) . pressed "(done_dialog)" .define function (setq dcl_id (load_dialog "lisp48d.exit if no dialog ).if (princ) ).if O.close dialog ).not (exit) .unload (if userclick .defun (princ) .inform the user ).defun (defun gotohelp () .K.inform the user (alert "You selected Cancel") .load dialog (if (not (new_dialog "gotohelp" dcl_id) .unload (princ) ).start dialog (unload_dialog dcl_id) .test for dialog ). . ok_cancel_help_info. } ok_only .Dcl file. DCL Coding: lisp48e : dialog { label = "ok_cancel_help_info" . } . ok_cancel_help_info. : text { label = "This is the Info Box" . The key of the OK button is 'accept'. The key of the Cancel button is 'cancel'. The key of the Help button is 'help'. The ok_cancel_help_info tile is defined in the Base. : text { label = "This is the Help Box" . The key of the Info button is 'info'. //dialog name //give it a label //predefined OK/Cancel/Help/ //Info button //end dialog //dialog name //give it a label //defin text //give it a label //end text //predefined OK Button //end dialog //dialog name //give it a label //define text //give it a label //end text } gotohelp : dialog { label = "Help Box" . Syntax: ok_cancel_help_info. } gotoinfo : dialog { label = "Info Box" . ok_only ; } //predefined OK Button //end dialog AutoLisp Coding: (defun C:lisp48e () ;define function (setq dcl_id (load_dialog "lisp48e.dcl")) ;load dialog (if (not (new_dialog "lisp48e" dcl_id) ;test for dialog );not (exit) ;exit if no dialog );if (action_tile "accept" ;if O.K. pressed "(done_dialog) (setq userclick T)" ;close dialog, set flag );action tile (action_tile "cancel" ;if cancel button pressed "(done_dialog) (setq userclick nil)" ;close dialog, lower flag );action_tile (action_tile "help" ;if help button pressed "(gotohelp)" ;call help function );action_tile (action_tile "info" ;if Info button pressed "(gotoinfo)" ;call info function );action_tile (start_dialog) ;start dialog (unload_dialog dcl_id) ;unload (if userclick ;if OK selected (alert "You selected OK") ;inform the user (alert "You selected Cancel") ;inform the user );if (princ) );defun (defun gotohelp () ;define function (setq dcl_id (load_dialog "lisp48e.dcl")) ;load dialog (if (not (new_dialog "gotohelp" dcl_id) ;test for dialog );not (exit) ;exit if no dialog );if (action_tile "accept" ;if O.K. pressed "(done_dialog)" ;close dialog );action tile (start_dialog) ;start dialog (unload_dialog dcl_id) ;unload (princ) );defun (defun gotoinfo () ;define function (setq dcl_id (load_dialog "lisp48e.dcl")) ;load dialog (if (not (new_dialog "gotoinfo" dcl_id) ;test for dialog );not (exit) ;exit if no dialog );if (action_tile "accept" ;if O.K. pressed "(done_dialog)" ;close dialog );action tile (start_dialog) ;start dialog (unload_dialog dcl_id) ;unload (princ) );defun (princ) errtile. Syntax: errtile; The errtile tile is defined in the Base.Dcl file. The key of the errtile is 'error'. DCL Coding: lisp48f : dialog { label = "errtile" ; ok_cancel ; errtile; } //dialog name //give it a label //predefined OK/Cancel button //predefined Error tile //end dialog AutoLisp Coding: (defun C:lisp48f () ;define function (setq dcl_id (load_dialog "lisp48f.dcl")) ;load dialog (if (not (new_dialog "lisp48f" dcl_id) ;test for dialog );not (exit) ;exit if no dialog );if (action_tile "accept" ;if O.K. pressed "(done_dialog) (setq userclick T)" ;close dialog, set flag );action tile (action_tile "cancel" ;if cancel button pressed "(done_dialog) (setq userclick nil)" ;close dialog, lower flag );action_tile ;the following would be called ;from your error handler (set_tile "error" ;if there is an error "There has been an *Error*" ;display this message );set_tile (start_dialog) ;start dialog (unload_dialog dcl_id) ;unload (if userclick ;if OK selected (alert "You selected OK") ;inform the user (alert "You selected Cancel") ;inform the user );if (princ) );defun (princ) button. Syntax: : button { action alignment fixed_height fixed_width height is_cancel is_default is_enabled is_tab_stop key label mnemonic width } DCL Coding: lisp48g : dialog { label = "button" ; : button { label = "Message"; key = "btn1"; mnemonic = "M"; fixed_width = true; alignment = centered; } ok_cancel ; } //dialog name //give it a label //add a button //give it a label //give it a name //give it a mnemonic //fix the width //center the button //end button //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48g () ;define function (setq dcl_id (load_dialog "lisp48g.dcl")) ;load dialog (if (not (new_dialog "lisp48g" dcl_id) ;test for dialog );not (exit) ;exit if no dialog if (action_tile "btn1" .K.do the following (setq col (itoa col)) .convert to string (alert (strcat "You selected Colour No: " col)) .action_tile (action_tile "accept" . pressed "(done_dialog) (setq userclick T)" .if the message button is pressed "(setq col (acad_colordlg 2))" .close dialog.if O.unload (if userclick .start dialog (unload_dialog dcl_id) .inform the user ).action tile (action_tile "cancel" .). lower flag ).defun .action_tile (start_dialog) .progn ).if OK selected (progn .if (princ) ).if cancel button pressed "(done_dialog) (setq userclick nil)" .display the AutoCAD colour dialogue ).close dialog. set flag ). (princ) . } //dialog name //give it a label //define edit box //give it a name //restrict to 8 letters //give it a label //define mnemonic //define password character //end edit box //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48h () . edit_limit = 8.define function (setq dcl_id (load_dialog "lisp48h.not (exit) .test for dialog ). mnemonic = "P". Syntax: : edit_box { action alignment allow_accept edit_limit edit_width fixed_height fixed_width height is_enabled is_tab_stop key label mnemonic value width password_char } DCL Coding: lisp48h : dialog { label = "edit_box" . } ok_cancel .dcl")) . : edit_box { key = "eb1". password_char = "*".load dialog (if (not (new_dialog "lisp48h" dcl_id) . label = "Enter Password".edit_box. exit if no dialog ).if a password is entered "(setq pass $value)" .start dialog (unload_dialog dcl_id) .if cancel button pressed "(done_dialog) (setq userclick nil)" .action_tile (start_dialog) .close dialog.if O. lower flag ).close dialog.display the password ). pressed "(done_dialog) (setq userclick T)" .if OK selected (alert (strcat "Password is: " pass)) .. set flag ).store the password in the variable 'pass' ).K.defun (princ) .action_tile (action_tile "accept" .action tile (action_tile "cancel" .if (action_tile "eb1" .if (princ) ).unload (if userclick . } //dialog name //give it a label //define list box //give it a name //end list //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48i () .setq .list_box.define function (setq NAMES '("Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday") ). Syntax: : list_box { action alignment allow_accept fixed_height fixed_width height is_enabled is_tab_stop key label list mnemonic multiple_select tabs value width } DCL Coding: lisp48i : dialog { label = "list_box" .define list . : list_box { key = "selections". } ok_cancel . if O.action tile (action_tile "cancel" .strcat ).action_tile (start_dialog) . pressed (strcat .close dialog ).not (exit) .start the list box (mapcar 'add_list NAMES) .string 'em together "(progn (setq SIZ (atof (get_tile \"selections\")))" .test for dialog ).end list (action_tile "accept" .if (start_list "selections") .if cancel button pressed "(done_dialog) (setq userclick nil)" .exit if no dialog ).close dialog ).unload (if userclick .dcl")) .load dialog (if (not (new_dialog "lisp48i" dcl_id) .(setq dcl_id (load_dialog "lisp48i.get list selection "(done_dialog) (setq userclick T))" .start dialog (unload_dialog dcl_id) .fill the list box (end_list) .K. check O.if it was do the following (setq SIZ (fix SIZ)) .K. was selected (progn .get the Day (alert (strcat "You Selected: " SIZ)) ..progn ).display the Day ).convert to integer (setq SIZ (nth SIZ NAMES)) .if userclick (princ) ).defun (princ) . define list (setq dcl_id (load_dialog "lisp48j. value = "5" .popup_list. } //dialog name //give it a label //define popup list //give it a label //give it a name //initial value //fix the width //end list //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48j () .define function (setq NAMES '("Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday") ).dcl")) .setq . edit_width = 12. } ok_cancel . key = "selections". : popup_list { label = "Choose Name:". Syntax: : popup_list { action alignment edit_width fixed_height fixed_width height is_enabled is_tab_stop key label list mnemonic tabs value width } DCL Coding: lisp48j : dialog { label = "popup_list" .load dialog . string 'em together "(progn (setq SIZ (atof (get_tile \"selections\")))" .(if (not (new_dialog "lisp48j" dcl_id) .K.close dialog ).exit if no dialog ).end list (action_tile "accept" .action tile (action_tile "cancel" . was selected .action_tile (start_dialog) .fill the list box (end_list) .start the list box (mapcar 'add_list NAMES) .if (start_list "selections") . pressed (strcat .get list selection "(done_dialog) (setq userclick T))" .if cancel button pressed "(done_dialog) (setq userclick nil)" .start dialog (unload_dialog dcl_id) .not (exit) .close dialog ).strcat ).if O.check O.test for dialog ).K.unload (if userclick . display the Day ).(progn .if userclick (princ) ).get the Day (alert (strcat "You Selected: " SIZ)) .defun (princ) .convert to integer (setq SIZ (nth SIZ NAMES)) .progn ).if it was do the following (setq SIZ (fix SIZ)) . } //dialog name //give it a label //*define radio button //*give it a name //*give it a label //*switch it on //*end definition //*define radio button //*give it a name //*give it a label //*end definition //*define radio button //*give it a name //*give it a label //*end definition //*define radio button //*give it a name //*give it a label //*end definition //predefined OK/Cancel button //end dialog . : radio_button { key = "rb1" . } : radio_button { key = "rb4" . label = "Bolt Holes Sho&p" . } : radio_button { key = "rb3" . label = "Bolt Holes &Site" . label = "Bolt Holes &Ctsnk" . label = "Bolt Holes &Hidden" .radio_button. Syntax: : radio_button { action alignment fixed_height fixed_width height is_enabled is_tab_stop key label mnemonic value width } DCL Coding: lisp48k : dialog { label = "radio_button" . } ok_cancel . } : radio_button { key = "rb2" . value = "1" . K.test for dialog ).*store hole type (action_tile "accept" .*store hole type (action_tile "rb4" "(setq hole \"Countersunk\")") .not (exit) .exit if no dialog ).*store hole type (action_tile "rb3" "(setq hole \"Hidden\")") .action tile (action_tile "cancel" .if cancel button pressed "(done_dialog) (setq userclick nil)" . pressed "(done_dialog) (setq userclick T)" .if O.load dialog (if (not (new_dialog "lisp48k" dcl_id) .close dialog ).store default hole type (setq dcl_id (load_dialog "lisp48k.start dialog .*store hole type (action_tile "rb2" "(setq hole \"Shop\")") .if (action_tile "rb1" "(setq hole \"Site\")") .define function (setq hole "Site") .close dialog ).AutoLisp Coding: (defun C:lisp48k () .dcl")) .action_tile (start_dialog) . check O.(unload_dialog dcl_id) .if userclick (princ) ).K. was selected (alert (strcat "You Selected: " hole)) .defun (princ) .unload (if userclick .display the Hole Type ). } ok_cancel . label = "Ortho On/Off".toggle. :toggle { key = "tog1".define function (setq dcl_id (load_dialog "lisp48l.load dialog (if (not (new_dialog "lisp48l" dcl_id) .test for dialog ).not . label = "Snap On/Off". } :toggle { key = "tog2". } //dialog name //give it a label //define toggle //give it a name //give it a label //end toggle //define toggle //give it a name //give it a label //end definition //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48l () .dcl")) . Syntax: : toggle { action alignment fixed_height fixed_width height is_enabled is_tab_stop key label mnemonic value width } DCL Coding: lisp48l : dialog { label = "toggle" . snap on/off "(done_dialog)(setq userclick T))" . set flag ).K.ortho on/off "(setvar \"snapmode\" (atoi sna))" .strcat ). pressed (strcat .get snap value (set_tile "tog2" sna) .get snap toggle value (action_tile "accept" .exit if no dialog ).switch toggle on or off (setq sna (itoa (getvar "snapmode"))) .(exit) .action_tile (start_dialog) .close dialog ).get orthomode value (set_tile "tog1" orth) .string 'em together "(progn (setvar \"orthomode\" (atoi orth))" .if (setq orth (itoa (getvar "orthomode"))) .get ortho toggle value (action_tile "tog2" "(setq sna $value)") .close dialog.if cancel button pressed "(done_dialog) (setq userclick nil)" .if O.action tile (action_tile "cancel" .switch toggle on or off (action_tile "tog1" "(setq orth $value)") . if (if (= sna 1) (alert "Snap is ON") (alert "Snap is OFF") ).if OK selected (progn .progn ).if ).unload (if userclick .start dialog (unload_dialog dcl_id) .defun (princ) .do the following (if (= orth 1) (alert "Ortho is ON") (alert "Ortho is OFF") )..if userclick (princ) ). } //dialog name //give it a label //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //end slider //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48m () . Syntax: : slider { action alignment big_increment fixed_height fixed_width height key label layout max_value min_value mnemonic small_increment value width } Note : As a slider should be used in conjunction with an edit box. the DCL and AutoLisp coding for the edit box has been included here. label = "Slot &Length (O/All Slot)" . edit_width = 6 .define function . : edit_box { key = "eb1" . value = "50". max_value = 100. } : slider { key = "myslider" . } ok_cancel .slider. DCL Coding: lisp48m : dialog { label = "slider" . min_value = 0. switch focus to edit box (action_tile "myslider" .if O.define function (if (or (= why 2) (= why 1)) .update slider (action_tile "accept" .dcl")) .0) .check values (set_tile "eb1" val))) .define function (if (or (= why 2) (= why 1)) .if (set_tile "eb1" "50") .check values (set_tile "myslider" val))) .pass arguments to slider_action (action_tile "eb1" .preset slot length (setq dcl_id (load_dialog "lisp48m.K.exit if no dialog ).pass arguments to ebox_action (defun slider_action (val why) .put data into edit box (mode_tile "eb1" 2) .load dialog (if (not (new_dialog "lisp48m" dcl_id) .test for dialog ).update edit box (defun ebox_action (val why) . pressed .(setq lngth 50.if user moves slider "(slider_action $value $reason)") .not (exit) .if user enters slot length "(ebox_action $value $reason)") . string 'em together "(progn (setq lngth (get_tile \"eb1\"))" . set flag ).start dialog (unload_dialog dcl_id) .unload (if userclick .K.(strcat . ).get slot length "(done_dialog)(setq userclick T))" .check O.strcat ).display the selected length.if cancel button pressed "(done_dialog) (setq userclick nil)" .action_tile (start_dialog) .close dialog.defun (princ) .action tile (action_tile "cancel" .close dialog ).if userclick (princ) ). was selected (alert (strcat "You Selected: " lngth)) . width = 2.0 .0 .0 . } : image_button { key = "im2" . fixed_width = true.image_button. fixed_width = true. allow_accept = true . } : image_button { key = "im1" . width = 2. allow_accept = true . fixed_width = true. height = 1.0 .0 . height = 1. allow_accept = true . height = 1. : image_button { key = "im0" . Syntax: : image_button { action alignment allow_accept aspect_ratio color fixed_height fixed_width height is_enabled is_tab_stop key label mnemonic width } DCL Coding: lisp48n : dialog { label = "image_button" .0 . width = 2. : boxed_row { label = "Choose a Colour". } //dialog name //give it a label //define a boxed row //gie it a label //define image button //give it a name //define height //define width //fix the width //allow double-click . } : image_button { key = "im4" . width = 2. allow_accept = true . height = 1.0 . fixed_width = true.0 . allow_accept = true . } : image_button { key = "im5" . fixed_width = true. width = 2.0 .0 .: image_button { key = "im3" . width = 2. height = 1. width = 2. } : image_button { key = "im6" . height = 1. } : image_button { key = "im7" . height = 1.0 .0 .0 . height = 1.0 . fixed_width = true. allow_accept = true .0 . fixed_width = true.define function . } //end boxed row //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48n () . allow_accept = true . allow_accept = true . } } ok_cancel . fixed_width = true. width = 2.0 . _ end of setq .test for dialog ).get the image height ) .not (exit) ._ end of setq (start_image "im2") (fill_image 0 0 width height 2) (end_image) (setq width (dimx_tile "im3") height (dimy_tile "im3") ) ._ end of setq (start_image "im1") (fill_image 0 0 width height 30) (end_image) (setq width (dimx_tile "im2") height (dimy_tile "im2") ) .get the image width height (dimy_tile "im0") .load dialog (if (not (new_dialog "lisp48n" dcl_id) ._ end of setq (start_image "im0") .fill it with the relevant colour (end_image) .dcl")) ._ end of setq (start_image "im3") (fill_image 0 0 width height 3) (end_image) (setq width (dimx_tile "im4") height (dimy_tile "im4") ) .exit if no dialog ).if (setq width (dimx_tile "im0") .start the image (fill_image 0 0 width height 1) .(setq dcl_id (load_dialog "lisp48n.end the image (setq width (dimx_tile "im1") height (dimy_tile "im1") ) . action_tile (start_dialog) .close dialog.close dialog ).(start_image "im4") (fill_image 0 0 width height 4) (end_image) (setq width (dimx_tile "im5") height (dimy_tile "im5") ) .action tile (action_tile "cancel" .if O._ end of setq (start_image "im7") (fill_image 0 0 width height 7) (end_image) (action_tile "im0" "(setq la \"0\")") 'get the name of the colour selected (action_tile (action_tile (action_tile (action_tile (action_tile (action_tile (action_tile "im1" "im2" "im3" "im4" "im5" "im6" "im7" "(setq "(setq "(setq "(setq "(setq "(setq "(setq la la la la la la la \"1\")") \"2\")") \"3\")") \"4\")") \"5\")") \"6\")") \"7\")") (action_tile "accept" ._ end of setq (start_image "im6") (fill_image 0 0 width height 6) (end_image) (setq width (dimx_tile "im7") height (dimy_tile "im7") ) ._ end of setq (start_image "im5") (fill_image 0 0 width height 5) (end_image) (setq width (dimx_tile "im6") height (dimy_tile "im6") ) .K.if cancel button pressed "(done_dialog) (setq userclick nil)" . pressed "(done_dialog)(setq userclick T)" . set flag ). K. ).if userclick (princ) ). was selected (alert (strcat "You Selected Colour: " la)) .display the colour selected..unload (if userclick .defun (princ) .check O.start dialog (unload_dialog dcl_id) . fixed_height = true. height = 5.0 . //dialog name //give it a label //begin row //define image tile //give it a name //and a height //and now a width //fix the width //fix the height //end image //define image tile //give it a name //add a height //and now a width //fix the width //fix the height //end image //define image tile //give it a name //add a height //and now a width //fix the width //fix the height //set background color . color = graphics_background. Syntax: : image { action alignment aspect_ratio color fixed_height fixed_width height is_enabled is_tab_stop key label mnemonic value width } DCL Coding: lisp48o : dialog { label = "image" . fixed_width = true.image. fixed_width = true.0 . fixed_height = true. height = 5. } : image { key = "im2" .0 . } : image { key = "im3" . fixed_width = true.0 .0 . height = 5. width = 10. width = 10. : row { : image { key = "im1" . width = 10. fixed_height = true.0 . get image tile width h (dimy_tile "im2") . } //end image //end row //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48o () .setq (start_image "im1") .get image tile height ).define function (setq dcl_id (load_dialog "lisp48o.load dialog (if (not (new_dialog "lisp48o" dcl_id) .exit if no dialog ).} } ok_cancel .test for dialog ).fill it with red (end_image) .not (exit) .start the image .setq (start_image "im2") .dcl")) .end image (setq w (dimx_tile "im2") .get image tile height ).get image tile width h (dimy_tile "im1") .start the image (fill_image 0 0 w h 1) .if (setq w (dimx_tile "im1") . set flag ).if cancel button pressed .setq (start_image "im3") .start the image (slide_image 0 0 w h "acad(torus)") .K.get image tile width h (dimy_tile "im3") .draw vector (end_image) .(fill_image 0 0 w h 5) .calculate vector (setq h1 (/ h 2)) .draw vector (vector_image w1 h1 w h 2) .fill the image with blue (setq w1 (/ w 2)) .end image (setq w (dimx_tile "im3") .draw vector (vector_image w1 0 w h 2) .draw vector (vector_image 0 h w1 h1 2) .close dialog.if O. pressed "(done_dialog) (setq userclick T)" .display a slide (end_image) .end image (action_tile "accept" .get image tile height ).action tile (action_tile "cancel" .calculate vector (vector_image 0 h w1 0 2) . start dialog (unload_dialog dcl_id) .close dialog. lower flag ).defun (princ) .unload (if userclick .inform the user ).inform the user (alert "You selected Cancel") .action_tile (start_dialog) .if OK selected (alert "You selected OK") .if (princ) )."(done_dialog) (setq userclick nil)" . ". value = "This is sample text.". } ok_cancel .text. alignment = centered. value = "This text is centered. } : text { key = "txt3".define function (setq dcl_id (load_dialog "lisp48p.load dialog .dcl")) . } //dialog name //give it a label //define text //give it a name //add some text //end text //define text //give it a name //end text //define text //give it a name //center the text //center the text //end text //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48p () . } : text { key = "txt2". Syntax: : text { alignment fixed_height fixed_width height is_bold key label value width } DCL Coding: lisp48p : dialog { label = "text" . : text { key = "txt1". set flag ).exit if no dialog ).") (action_tile "accept" .close dialog.close dialog.start dialog (unload_dialog dcl_id) .if (princ) ).action tile (action_tile "cancel" .inform the user ).not (exit) . lower flag ).if OK selected (alert "You selected OK") .action_tile (start_dialog) .defun (princ) .unload (if userclick .if cancel button pressed "(done_dialog) (setq userclick nil)" .if (set_tile "txt2" "AutoLisp wrote this.(if (not (new_dialog "lisp48p" dcl_id) .K.test for dialog ). pressed "(done_dialog) (setq userclick T)" .inform the user (alert "You selected Cancel") .if O. } : spacer { height = 3. fixed_width = true. } : button { //dialog name //give it a label //define button //give it a name //give it a label //fix it's width //center it //end button //define space //define height //end spacer //define button .spacer. : button { key = "btn1". label = "Button1". Dialogue Without Spacer Dialogue With Spacer Syntax: : spacer { alignment fixed_height fixed_width height width } DCL Coding: lisp48q : dialog { label = "spacer" . alignment = centered. close dialog.action_tile (start_dialog) . set flag ).close dialog.unload (if userclick . } ok_cancel .if O.dcl")) .K.not (exit) . pressed "(done_dialog) (setq userclick T)" .start dialog (unload_dialog dcl_id) .if (action_tile "accept" . alignment = centered.key = "btn2".action tile (action_tile "cancel" . fixed_width = true.test for dialog ). lower flag ).if cancel button pressed "(done_dialog) (setq userclick nil)" .exit if no dialog ).define function (setq dcl_id (load_dialog "lisp48q. label = "Button1".load dialog (if (not (new_dialog "lisp48q" dcl_id) . } //give it a name //give it a label //fix it's width //center it //end button //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48q () . defun (princ) .if (princ) ).inform the user (alert "You selected Cancel") .if OK selected (alert "You selected OK") ..inform the user ). The spacer_0 tile is defined in the Base. : radio_button { label = "3". } : radio_button { label = "2".spacer_0. DCL Coding: lisp48r : dialog { label = "spacer_0" . value = "1". : row { : radio_button { label = "1". key = "rb3". key = "rb2".Dcl file. } spacer_0. key = "rb1". } //dialog name //give it a label //define row //define radio button //give it a label //give it a name //switch it on //end radio button //define radio button //give it a label //give it a name //end radio button //add spacer_0 //define radio button //give it a label //give it a name //end radio button . Dialogue Without Spacer_0 Dialogue With Spacer_0 Syntax: spacer_0. pressed "(done_dialog) (setq userclick T)" .if OK selected (alert "You selected OK") .close dialog.action_tile (start_dialog) .if (action_tile "accept" .K.load dialog (if (not (new_dialog "lisp48r" dcl_id) .if O.} ok_cancel .dcl")) .not (exit) . lower flag ).test for dialog ).inform the user .action tile (action_tile "cancel" . } //end row //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48r () .exit if no dialog ).if cancel button pressed "(done_dialog) (setq userclick nil)" .define function (setq dcl_id (load_dialog "lisp48r. set flag ).unload (if userclick .start dialog (unload_dialog dcl_id) .close dialog. if (princ) ).(alert "You selected Cancel") .defun (princ) .inform the user ). key = "rb1". : row { : radio_button { label = "1". DCL Coding: lisp48s : dialog { label = "spacer_1" . The spacer_1 tile is defined in the Base. value = "1". key = "rb3". } : radio_button { label = "2". Dialogue Without Spacer_1 Dialogue With Spacer_1 Syntax: spacer_1. key = "rb2".Dcl file. } spacer_1.spacer_1. } //dialog name //give it a label //define row //define radio button //give it a label //give it a name //switch it on //end radio button //define radio button //give it a label //give it a name //end radio button //add spacer_1 //define radio button //give it a label //give it a name //end radio button . : radio_button { label = "3". start dialog (unload_dialog dcl_id) .dcl")) .exit if no dialog ).test for dialog ).if (action_tile "accept" .load dialog (if (not (new_dialog "lisp48s" dcl_id) .if cancel button pressed "(done_dialog) (setq userclick nil)" .close dialog.K. pressed "(done_dialog) (setq userclick T)" .not (exit) . } //end row //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48s () .if O.} ok_cancel .unload (if userclick . set flag ). lower flag ).if OK selected (alert "You selected OK") .close dialog.inform the user .action_tile (start_dialog) .define function (setq dcl_id (load_dialog "lisp48s.action tile (action_tile "cancel" . inform the user ).defun (princ) .(alert "You selected Cancel") .if (princ) ). concatenation. Syntax: : concatenation { } The concatenation tile is defined in the Base. } } ok_cancel . DCL Coding: lisp48t : dialog { label = "concatenation" .define function (setq dcl_id (load_dialog "lisp48t. } //dialog name //give it a label //define concatenation //text part //add text //end text //text part //add text //end text //text part //add text //end text //end concatenation //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48t () . } : text_part { label = "of words". } : text_part { label = "concenantation". : concatenation { : text_part { label = "This is a".dcl")) .load dialog .Dcl file. test for dialog ).start dialog (unload_dialog dcl_id) . pressed "(done_dialog) (setq userclick T)" .exit if no dialog ).close dialog.if (action_tile "accept" .if OK selected (alert "You selected OK") .inform the user (alert "You selected Cancel") . set flag ). lower flag ).defun (princ) .close dialog.unload (if userclick .inform the user ).not (exit) .action tile (action_tile "cancel" .if O.K.action_tile (start_dialog) .if cancel button pressed "(done_dialog) (setq userclick nil)" .if (princ) ).(if (not (new_dialog "lisp48t" dcl_id) . Dcl file. DCL Coding: lisp48u : dialog { label = "paragraph" . } : text_part { label = "of words. } : text_part { label = "paragraph". } //dialog name //give it a label //define paragraph //text //add text //center the text //end text //text //add text //center the text //end text //text //add text //center the text //end text //end paragraph //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48u () .paragraph. alignment = centered. alignment = centered.". Syntax: : paragraph { } The paragraph tile is defined in the Base. : paragraph { : text_part { label = "This is a". } } ok_cancel . alignment = centered. if O.action tile (action_tile "cancel" .action_tile (start_dialog) .load dialog (if (not (new_dialog "lisp48u" dcl_id) . lower flag ).if (princ) ).test for dialog ).inform the user ).if OK selected (alert "You selected OK") .defun (princ) .define function (setq dcl_id (load_dialog "lisp48u.close dialog.K..if (action_tile "accept" . pressed "(done_dialog) (setq userclick T)" .close dialog. set flag ).not (exit) .unload (if userclick .inform the user (alert "You selected Cancel") .exit if no dialog ).start dialog (unload_dialog dcl_id) .if cancel button pressed "(done_dialog) (setq userclick nil)" .dcl")) . . text_part. Syntax: : text_part { key label } The text_part tile is defined in the Base. DCL Coding: lisp48v : dialog { label = "text_part" . alignment = centered.Dcl file. } //dialog name //give it a label //define paragraph //text //add text //center the text //end text //text //add text //center the text //end text //text //give it a name //center the text //end text //end paragraph //predefined OK/Cancel button //end dialog AutoLisp Coding: . } : text_part { key = "txt1". alignment = centered. alignment = centered. } } ok_cancel . } : text_part { label = "Layer". : paragraph { : text_part { label = "You are on". inform the user ). pressed "(done_dialog) (setq userclick T)" .close dialog.unload (if userclick . lower flag ).action_tile (start_dialog) .load dialog (if (not (new_dialog "lisp48v" dcl_id) .exit if no dialog ).K.test for dialog ). set flag ).inform the user (alert "You selected Cancel") .not (exit) .if OK selected (alert "You selected OK") .close dialog.start dialog (unload_dialog dcl_id) .if (princ) .if cancel button pressed "(done_dialog) (setq userclick nil)" .action tile (action_tile "cancel" .dcl")) .if (set_tile "txt1" la) (action_tile "accept" .define function (setq la (getvar "clayer")) (setq dcl_id (load_dialog "lisp48v.(defun C:lisp48v () .if O. defun (princ) .). value = "2". DCL Coding: lisp48w : dialog { label = "boxed_column" . Syntax: : boxed_column { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. label = "Toggle 1". } : toggle { key = "tog3". : boxed_column { label = "boxed column". label = "Toggle 1". } : toggle { key = "tog2". value = "1".boxed_column. No AutoLisp coding has been included for the Active Children Tiles. value = "1". label = "Toggle 1". : toggle { key = "tog1". } } //dialog name //give it a label //define boxed column //give it a label //define a toggle //give it a name //give it a label //switch it on //end toggle //define a toggle //give it a name //give it a label //switch it off //end toggle //define a toggle //give it a name //give it a label //switch it on //end toggle //end boxed column . if OK selected (alert "You selected OK") .action tile (action_tile "cancel" . lower flag ).action_tile (start_dialog) .define function (setq dcl_id (load_dialog "lisp48w.ok_cancel .inform the user .start dialog (unload_dialog dcl_id) .K.if (action_tile "accept" .test for dialog ).load dialog (if (not (new_dialog "lisp48w" dcl_id) .dcl")) .if cancel button pressed "(done_dialog) (setq userclick nil)" .close dialog. } //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48w () .unload (if userclick . pressed "(done_dialog) (setq userclick T)" . set flag ).if O.close dialog.exit if no dialog ).not (exit) . inform the user ).(alert "You selected Cancel") .defun (princ) .if (princ) ). Syntax: : boxed_radio_column { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. } : radio_button { key = "rad2". label = "Red Head". label = "Blonde". DCL Coding: lisp48x : dialog { label = "boxed_radio_column". : radio_button { key = "rad1". value = "1".boxed_radio_column. : boxed_radio_column { label = "boxed radio column". label = "Brunette". No AutoLisp coding has been included for the Active Children Tiles. } : radio_button { key = "rad3". } } //dialog name //give it a label //define boxed radio column //give it a label //define a radio button //give it a name //give it a label //switch it on //end radio button //define a radio button //give it a name //give it a label //end radio button //define a radio button //give it a name //give it a label //end radio button //end boxed radio column . start dialog (unload_dialog dcl_id) .define function (setq dcl_id (load_dialog "lisp48x.unload (if userclick . set flag ).action_tile (start_dialog) .ok_cancel .dcl")) . pressed "(done_dialog) (setq userclick T)" .exit if no dialog ).if cancel button pressed "(done_dialog) (setq userclick nil)" . lower flag ).close dialog. } //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48x () .close dialog.K.if OK selected (alert "You selected OK") .if (action_tile "accept" .test for dialog ).if O.not (exit) .inform the user .action tile (action_tile "cancel" .load dialog (if (not (new_dialog "lisp48x" dcl_id) . if (princ) ).inform the user ).(alert "You selected Cancel") .defun (princ) . //predefined OK/Cancel button . label = "Red Head". No AutoLisp coding has been included for the Active Children Tiles.boxed_radio_row. Syntax: : boxed_radio_row { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. DCL Coding: lisp48y : dialog { label = "boxed_radio_row". : radio_button { key = "rad1". label = "Blonde". } } //dialog name //give it a label //define boxed radio row //give it a label //define a radio button //give it a name //give it a label //switch it on //end radio button //define a radio button //give it a name //give it a label //end radio button //define a radio button //give it a name //give it a label //end radio button //end boxed radio row ok_cancel . : boxed_radio_row { label = "boxed radio row". label = "Brunette". } : radio_button { key = "rad2". } : radio_button { key = "rad3". value = "1". if OK selected (alert "You selected OK") .inform the user (alert "You selected Cancel") .load dialog (if (not (new_dialog "lisp48y" dcl_id) .action tile (action_tile "cancel" .close dialog.dcl")) .exit if no dialog ).unload (if userclick .if (action_tile "accept" .define function (setq dcl_id (load_dialog "lisp48y.start dialog (unload_dialog dcl_id) .test for dialog ). set flag ).not (exit) .K.} //end dialog AutoLisp Coding: (defun C:lisp48y () .if O.action_tile (start_dialog) . lower flag ).close dialog. pressed "(done_dialog) (setq userclick T)" .if cancel button pressed "(done_dialog) (setq userclick nil)" .inform the user . if (princ) ).defun (princ) .). : boxed_row { label = "boxed row". value = "1". label = "Beer". } } //dialog name //give it a label //define boxed row //give it a label //define a toggle //give it a name //give it a label //switch it on //end toggle //define a toggle //give it a name //give it a label //switch it on //end toggle //define a toggle //give it a name //give it a label //switch it on //end toggle //end boxed row .boxed_row. value = "0". Syntax: : boxed_row { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. : toggle { key = "tog1". label = "Whiskey". No AutoLisp coding has been included for the Active Children Tiles. } : toggle { key = "tog2". } : toggle { key = "tog3". value = "1". DCL Coding: lisp48z : dialog { label = "boxed_row". label = "Wine". dcl")) .if O.action tile (action_tile "cancel" .if OK selected (alert "You selected OK") .close dialog. } //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48z () . pressed "(done_dialog) (setq userclick T)" .action_tile (start_dialog) .test for dialog ).ok_cancel .unload (if userclick .if (action_tile "accept" .load dialog (if (not (new_dialog "lisp48z" dcl_id) .inform the user (alert "You selected Cancel") .K. lower flag ). set flag ).if cancel button pressed "(done_dialog) (setq userclick nil)" .close dialog.start dialog (unload_dialog dcl_id) .not (exit) .define function (setq dcl_id (load_dialog "lisp48z.exit if no dialog ). inform the user ).if (princ) ).defun (princ) .. value = "1". value = "2". : column { : toggle { key = "tog1". label = "Toggle 1". DCL Coding: lisp48aa : dialog { label = "column" . No AutoLips coding has been included for the Active Children Tiles. } : toggle { key = "tog2". value = "1". label = "Toggle 1".column. } : toggle { key = "tog3". Syntax: : column { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. } } //dialog name //give it a label //define column //define a toggle //give it a name //give it a label //switch it on //end toggle //define a toggle //give it a name //give it a label //switch it off //end toggle //define a toggle //give it a name //give it a label //switch it on //end toggle //end column . label = "Toggle 1". lower flag ).if (action_tile "accept" .start dialog (unload_dialog dcl_id) .if OK selected (alert "You selected OK") .if O. set flag ).unload (if userclick .close dialog.define function (setq dcl_id (load_dialog "lisp48aa. pressed "(done_dialog) (setq userclick T)" .exit if no dialog ). } //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48aa () .action_tile (start_dialog) .dcl")) .not (exit) .inform the user .K.action tile (action_tile "cancel" .test for dialog ).load dialog (if (not (new_dialog "lisp48aa" dcl_id) .if cancel button pressed "(done_dialog) (setq userclick nil)" .ok_cancel .close dialog. (alert "You selected Cancel") .if (princ) ).defun (princ) .inform the user ). Syntax: : dialog { initial_focus label value } DCL Coding: lisp48ab : dialog { label = "dialog" .K.close dialog. } //dialog name //give it a label //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp48ab () .if (action_tile "accept" .load dialog (if (not (new_dialog "lisp48ab" dcl_id) .if O.dialog.exit if no dialog ). pressed "(done_dialog) (setq userclick T)" .dcl")) .test for dialog ). ok_cancel . set flag .define function (setq dcl_id (load_dialog "lisp48ab.not (exit) . defun (princ) .close dialog.start dialog (unload_dialog dcl_id) .if (princ) ).if OK selected (alert "You selected OK") .).inform the user (alert "You selected Cancel") . lower flag ).inform the user ).unload (if userclick .action_tile (start_dialog) .if cancel button pressed "(done_dialog) (setq userclick nil)" .action tile (action_tile "cancel" . : radio_column { : radio_button { key = "rad1".radio_column. //predefined OK/Cancel button . Syntax: : radio_column { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. value = "1". label = "Blonde". label = "Brunette". } : radio_button { key = "rad3". } : radio_button { key = "rad2". } } //dialog name //give it a label //define radio column //define a radio button //give it a name //give it a label //switch it on //end radio button //define a radio button //give it a name //give it a label //end radio button //define a radio button //give it a name //give it a label //end radio button //end radio column ok_cancel . DCL Coding: lisp48ac : dialog { label = "radio_column". No AutoLips coding has been included for the Active Children Tiles. label = "Red Head". action_tile (start_dialog) .close dialog.if (action_tile "accept" .load dialog (if (not (new_dialog "lisp48ac" dcl_id) .define function (setq dcl_id (load_dialog "lisp48ac.inform the user (alert "You selected Cancel") .exit if no dialog ).inform the user . pressed "(done_dialog) (setq userclick T)" .not (exit) .K.if OK selected (alert "You selected OK") .test for dialog ).action tile (action_tile "cancel" .start dialog (unload_dialog dcl_id) .} //end dialog AutoLisp Coding: (defun C:lisp48ac () .dcl")) .if cancel button pressed "(done_dialog) (setq userclick nil)" .if O.close dialog. lower flag ). set flag ).unload (if userclick . if (princ) ).defun (princ) .). label = "Brunette". } //predefined OK/Cancel button //end dialog .radio_row. Syntax: : radio_row { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. value = "1". : radio_row { : radio_button { key = "rad1". label = "Red Head". label = "Blonde". DCL Coding: lisp48ad : dialog { label = "radio_row". } } //dialog name //give it a label //define radio row //define a radio button //give it a name //give it a label //switch it on //end radio button //define a radio button //give it a name //give it a label //end radio button //define a radio button //give it a name //give it a label //end radio button //end radio row ok_cancel . No AutoLisp coding has been included for the Active Children Tiles. } : radio_button { key = "rad3". } : radio_button { key = "rad2". action_tile (start_dialog) .action tile (action_tile "cancel" .define function (setq dcl_id (load_dialog "lisp48ad.if OK selected (alert "You selected OK") .inform the user (alert "You selected Cancel") .inform the user ).if (princ) .dcl")) .start dialog (unload_dialog dcl_id) .if cancel button pressed "(done_dialog) (setq userclick nil)" . set flag ).if O.K.close dialog.not (exit) .AutoLisp Coding: (defun C:lisp48ad () .exit if no dialog ).load dialog (if (not (new_dialog "lisp48ad" dcl_id) .test for dialog ).unload (if userclick . pressed "(done_dialog) (setq userclick T)" .close dialog. lower flag ).if (action_tile "accept" . ).defun (princ) . label = "Wine". label = "Whiskey". DCL Coding: lisp48ae : dialog { label = "row". //predefined OK/Cancel button . } } //dialog name //give it a label //define row //define a toggle //give it a name //give it a label //switch it on //end toggle //define a toggle //give it a name //give it a label //switch it on //end toggle //define a toggle //give it a name //give it a label //switch it on //end toggle //end row ok_cancel . label = "Beer". } : toggle { key = "tog3". No AutoLisp coding has been included for the Active Children Tiles. } : toggle { key = "tog2". value = "1". : row { : toggle { key = "tog1".row. value = "1". Syntax: : row { alignment children_alignment children_fixed_height children_fixed_width fixed_height fixed_width height label width } Note: This Tile Cluster is for display purpose only. value = "0". close dialog.K. lower flag ).} //end dialog AutoLisp Coding: (defun C:lisp48ae () . pressed "(done_dialog) (setq userclick T)" .action_tile (start_dialog) .if O.test for dialog ).inform the user (alert "You selected Cancel") .close dialog.load dialog (if (not (new_dialog "lisp48ae" dcl_id) .start dialog (unload_dialog dcl_id) .not (exit) .exit if no dialog ).if OK selected (alert "You selected OK") .action tile (action_tile "cancel" .dcl")) . set flag ).if cancel button pressed "(done_dialog) (setq userclick nil)" .inform the user .if (action_tile "accept" .define function (setq dcl_id (load_dialog "lisp48ae.unload (if userclick . defun (princ) .if (princ) ).). and the sample DCL Coding that was used to create the dialog. If you are familiar with Visual Basic.1 not . beginning with a letter. Quoted String A quoted string consists of text enclosed in quotation marks (" "). "RB1" is not the same as "rb1". Reserved words are case sensitive: True does not equal true.1. The sample AutoLisp coding required to display each dialog can be found in the downloadable tutorial.g. Attributes in DCL define the layout and functionality of tiles. DCL Attributes consist of a name and a value.g. I have provided a sample dialog image of each of the various aspects of attributes. Note: The value of certain attributes can change at run-time.DCL Tile Attributes This tutorial will give you a detailed explanation of all attributes used in the design and implementation of dialog boxes used within AutoCAD/AutoLisp. The value of a tile's attribute must be one of the following type: Integer Numeric Values (integer or real number) that represent distances such as width. 0. or height of a tile. Reserved Word A reserved word is an identifier made up of alphanumeric characters. e. Real Number A fractional real number must have a leading digit. Attribute values are case sensitive. you will find that they are very similar to properties. true or false. e. Attribute : alignment fixed_height fixed_width height width Applies To : All Tiles . with user input or 'set_tile' calls. Global Attributes. Attributes Associative with Specific Tiles Attribute : allow_accept Applies To : edit_box. radio_column. list_box Attribute : aspect_ration . popup_list. list_box. column. edit_box. image_button. toggle. radio_button. boxed_radio_column.Attributes Associated with Action Tiles Attribute : action is_enabled is_tab_stop key mnemonic Applies To : button. radio_row. radio_column. Attributes Associated with Tile Clusters Attribute : children_alignment children_fixed_height children_fixed_width Applies To : row. boxed_row. radio_row. boxed_column. slider. image_button. boxed_radio_row. image_button. Attribute : edit_limit Applies To : edit_box. Attribute : color Applies To : image.Applies To : image. popup_list. . Attribute : big_increment Applies To : slider. Attribute : initial_focus Applies To : dialog. Attribute : fixed_width_font Applies To : edit_box. image_button. Attribute : edit_width Applies To : edit_box. popup_list. Attribute : is_default Applies To : button. boxed_radio_row.Attribute : is_cancel Applies To : button. popup_list. Attribute : list Applies To : list_box. text. dialog. boxed_radio_column. . Attribute : layout Applies To : slider. popup_list. radio_button. Attribute : max_value Applies To : slider. button. boxed_column. edit_box list_box. toggle. Attribute : label Applies To : boxed_row. Attribute : password_char Applies To : edit_box. popup_list. Attribute : small_increment Applies To : slider. Attribute : tab_truncate Applies To : list_box. Attribute : multiple_select Applies To : list_box. popup_list . Attribute : tabs Applies To : list_box.Attribute : min_value Applies To : slider. . all active tiles (except buttons and image_buttons).Attribute : value Applies To : text. alignment Aligned Centered. Aligned Right. This attribute specifies the horizontal or vertical positioning of a tile within its cluster. If a tile is within a column, the possible values are: left, right or centered. (default: left) If a tile is within a row, the possible values are: top, bottom or centered. (default: centered) You cannot specify the alignment along the long axis of a cluster. The first and last tiles in the cluster always align themselves to the ends of the column or row. DCL Code Sample lisp49a : dialog { label = "aligment" ; : button { label="Button"; fixed_width=true; alignment=right; } ok_cancel ; } //dialog name //give it a label //define button //give it a label //fix the width //align right //end button //predefined OK/Cancel button //end dialog fixed_height Fixed_Height Not Set. Fixed_Height Set to True. This attribute specifies whether a tiles height is allowed to fill the available white space. If this attribute is true, the tile will be restricted to it's preset height attribute. Possible values are: true or false. (default: false) DCL Code Sample lisp49b : dialog { label = "fixed_height"; : row { : list_box { key = "lb1"; //dialog name //give it a label //define a row //define a list box //give it a name label = "List Box 1"; list = "1\n2\n3\n4\n5\n6\n7\n8\n9"; } : list_box { key = "lb2"; label = "List Box 2"; list = "A\nB\nC\nD"; height = 5; fixed_height = true; alignment = top; } } ok_cancel ; } //give it a label //make a list //define a list box //give it a name //give it a label //make a list //set the height //fix the height //align to top //end list box //end row //predefined OK/Cancel button //end dialog fixed_width Fixed_Width Not Set. Fixed_Width Set to True. This attribute specifies whether a tiles width is allowed to fill the available white space. If this attribute is true, the tile will be restricted to it's preset width attribute. Possible values are: true or false. (default = false) DCL Code Sample lisp49c : dialog { label = "fixed_width"; : edit_box { key = "eb1"; label = "Edit Box 1"; width = 24; value = "A SMALL Box"; fixed_width = true; } : edit_box { key = "eb2"; label = "Edit Box 2"; value = "...This is a LARGE Box..."; } ok_cancel_help ; } //dialog name //give it a label //define an edit box //give it a name //give it a label //give it a width //give it a value //fix the width //end edit box //define an edit box //give it a name //give it a label //give it a value //end edit box //predefined OK/Cancel/Help button //end dialog height Height Not Set. Height Set to 15. This attribute specifies the height of tile. The height value must be an integer or a real number. The height of image tiles and image buttons must be specified. Note: The height of a tile is the MINIMUM value. Possible values are platform dependent. DCL Code Sample lisp49d : dialog { //dialog name label = "height"; : list_box { key = "lb1"; label = "List Box 1"; list = "1\n2\n3\n4\n5\n6\n7\n8\n9"; height = 15; } ok_cancel ; } //give it a label //define a list box //give it a name //give it a label //make a list //give it a height //end list box //predefined OK/Cancel button //end dialog width = 30. This attribute specifies the width of tile.width Width Not Set. Note: The width of a tile is the MINIMUM value. : edit_box { key = "eb1". The width value must be an integer or a real value. } ok_cancel . DCL Code Sample lisp49e : dialog { label = "width". Width Set to 30. Possible values are platform dependent. value = "This is a longer box". The width of image tiles and image buttons must be specified. } //dialog name //give it a label //define an edit box //give it a name //give it a value //give it a width //end edit box //predefined OK/Cancel button //end dialog . //give it a label action = "(alert \"Kenny is Great\")". } //predefined OK/Cancel button //end dialog . //dialog name //give it a label : button { //define a button fixed_width = true. //center it label = "Action Button". //Trigger an AutoLisp Function } //end button ok_cancel .action Action Attribute in action. eg. This attribute specifies an AutoLisp expression to activate. The value must be quoted. "(acad_colordlg 3)" DCL Code Sample lisp49f : dialog { label = "action". //fix it's width alignment = centered. value = "1". : boxed_radio_row { label = "Choose :". } //dialog name //give it a label //define boxed radio row //give it a label //define radio button //give it a label //give it a name //make it default //end radio button //define radio button //give it a label //give it a name //end radio button //end boxed radio row //define boxed radio row //define radio button //give it a label //give it a name //make it default //end radio button . (Unavailable. } } : boxed_radio_row { : radio_button { label = "&Big".is_enabled Enabled/Disabled. : radio_button { label = "&Large". key = "rb1". key = "rb2". (default: true). DCL Code Sample lisp49g : dialog { label = "is_enabled". This attribute specifies whether a tile is initially grayed out. value = "1".) Possible values are: true or false. key = "rb3". } : radio_button { label = "&Small". ok_cancel . } : radio_button { label = "&Very Small". } } spacer. key = "rb4".: radio_button { label = "&Very Big". key = "rb5". is_enabled = false.define function (setq dcl_id (load_dialog "lisp49g. } //define radio button //give it a label //give it a name //end radio button //end boxed radio row //define boxed radio row //define radio button //give it a label //give it a name //switch off //end radio button //define radio button //give it a label //give it a name //make it default //switch off //end radio button //end boxed radio row //define spacer //predefined OK/Cancel button //end dialog AutoLisp Coding: (defun C:lisp49g () .exit if no dialog ). value = "1".dcl")) . } } : boxed_radio_row { : radio_button { label = "&Small". is_enabled = false. key = "rb6".load dialog (if (not (new_dialog "lisp49g" dcl_id) .test for dialog ).if (action_tile "rb2" "(mode_tile \"rb3\" 1) (mode_tile \"rb4\" 1) (mode_tile \"rb5\" 0) (mode_tile \"rb6\"0)" .not (exit) . action tile (action_tile "cancel" .defun (princ) . lower flag ).start dialog (unload_dialog dcl_id) . pressed "(done_dialog) (setq userclick T)" .K.if cancel button pressed "(done_dialog) (setq userclick nil)" .unload (princ) ).close dialog.if O.action_tile (start_dialog) . set flag ).) (action_tile "rb1" "(mode_tile \"rb3\" 0) (mode_tile \"rb4\" 0) (mode_tile \"rb5\" 1) (mode_tile \"rb6\" 1)" ) (action_tile "accept" .close dialog. Possible values are: true or false. fixed_width = true. } . width = 40. true.is_tab_stop Tab Stops This attribute specifies whether a tile is a tab stop. label = "Edit value = "This width = 40. width = 40. If false. value = "This is another Tab Stop".) If a tile is disabled. fixed_width = true. the tile is not a tab stop. label = "Edit Box 1". : edit_box { key = "eb1". : edit_box { key = "eb3". it isn't a tab stop even if this attribute is set to true. label = "Edit Box 3". (receives keyboard focus when the user moves between tiles by pressing the "Tab" key. (default: true). fixed_width = is_tab_stop = } //dialog name //give it a label //define edit box //give it a name //give it a label //give it a value //give it a width //fix the width //end edit box //define edit box //give it a name //give it a label //give it a value //give it a width //fix the width //no tab stop //end edit box //define edit box //give it a name //give it a label //give it a value //give it a width //fix the width //end edit box Box 2". false. is NOT a Tab Stop". } : edit_box { key = "eb2". value = "This is a Tab Stop". DCL Code Sample lisp49h : dialog { label = "is_tab_stop". } //define spacer //predefined OK/Cancel button //end dialog .spacer. ok_cancel . //give it a width fixed_width = true. //give it a value } //end edit box . //give it a label width = 40. Each key value MUST be unique within a dialogue definition. //give it a name label = "Edit Box 1". //fix the width value = "Enter a Number and press Tab". //fix the width value = "Enter a Number and press Tab". //give it a name label = "Edit Box 2". //give it a label width = 40. ("eb1" does not equal "Eb1"). //give it a width fixed_width = true. //give it a width fixed_width = true. //give it a label width = 40. //give it a name label = "Edit Box 3". //give it a value } //end edit box : edit_box { //define edit box key = "eb2". //fix the width value = "Enter a Number and press Tab". //give it a value } //end edit box : edit_box { //define edit box key = "eb3". //dialog name //give it a label : edit_box { //define edit box key = "eb1".key A List of Keys This attribute specifies an ASCII name that your program uses to refer to a specific tile. DCL Code Sample lisp49i : dialog { label = "key". It must be a quoted string (no default) and is case sensitive. } : edit_box { key = "eb5".if (mode_tile "eb1" 2) (mode_tile "eb1" 3) (action_tile "eb1" . width = 40. width = 40. } //define edit box //give it a name //give it a label //give it a width //fix the width //end edit box //define edit box //give it a name //give it a label //give it a width //fix the width //end edit box //define edit box //give it a name //give it a label //give it a width //fix the width //end edit box //define spacer //predefined OK/Cancel button //end dialog AutoLisp Code Sample (defun C:lisp49i () .: edit_box { key = "eb4".not (exit) . fixed_width = true. label = "Key Edit Box 1". ok_cancel .define function (setq dcl_id (load_dialog "lisp49i.if this tile is selected "(setq a $key) . label = "Key Edit Box 3". } : edit_box { key = "eb6". label = "Key Edit Box 2".exit if no dialog ).dcl")) . fixed_width = true. } spacer. fixed_width = true.test for dialog ). width = 40.load dialog (if (not (new_dialog "lisp49i" dcl_id) . close dialog.retrieve it's name (set_tile \"eb5\" b) .action tile (action_tile "cancel" .if this tile is selected "(setq b $key) .retrieve it's name (set_tile \"eb4\" a)" .if this tile is selected "(setq c $key) .if O.start dialog (unload_dialog dcl_id) .if cancel button pressed "(done_dialog) (setq userclick nil)" .set the tile 'eb6' to it's name ) (action_tile "accept" .action_tile (start_dialog) .K.close dialog.set the tile 'eb5' to it's name (mode_tile a 1)" .. pressed "(done_dialog) (setq userclick T)" . set flag ).unload (if userclick . lower flag ).switch off the tile 'eb2' ) (action_tile "eb3" .set the tile 'eb4' to it's name ) (action_tile "eb2" .retrieve it's name (set_tile \"eb6\" c)" . defun (princ) ..if (princ) ).inform the user ).if OK selected (alert "You selected OK") .inform the user (alert "You selected Cancel") . alignment = centered. The mnemonic character is underlined in the tile's label. label = "Button No 1". The value is a quoted string of a single character that must be one of the letters of the tile's label. ok_cancel . If more that one tile has the same mnemonic. } spacer. : button { key = "btn1". DCL Code Sample lisp49j : dialog { label = "mnemonic". (No default). mnemonic = "1". fixed_width = true. you press Tab to cycle through the tiles sequentially.mnemonic Mnemonic This attribute specifies a keyboard mnemonic character for a tile. The character does not have to be unique to the dialogue box. } . } : button { key = "btn2". //dialog name //give it a label //define a button //give it a name //give it a label //fix it's width //centre it //the mnemonic //end button //define a button //give it a name //give it a label //and define the //mnemonic //fix it's width //centre it //end button //add a spacer //predefined OK/Cancel button //end dialog fixed_width = true. alignment = centered. The label attribute can also specify a mnemonic by preceding a character with an ampersand: (&). label = "Button No &2". . fixed_width = true. fixed_width = true.children_alignment Aligned Center This attribute specifies the default alignment for all tiles in a cluster. Possible values for columns are left. It does not override a child's alignment attribute if that is set. : column { children_alignment = right. label = "Button No &1". } : button { key = "btn2". fixed_width = true. } : button { key = "btn3". : button { key = "btn1". label = "Button No &3". //dialog name //give it a label //define a column //put tiles on the right //define a button //give it a name //give it a label //fix it's width //end button //define a button //give it a name //give it a label //fix it's width //override default //alignment //end button //define a button //give it a name //give it a label //fix it's width . default: left Possible values for rows are top. default: centered DCL Code Sample lisp49k : dialog { label = "children_alignment". bottom or centered. right or centered. alignment = left. label = "Button No &2". ok_cancel .} } spacer. } //end button //end column //add a spacer //predefined OK/Cancel button //end dialog . height = 5. (default: false) DCL Code Sample lisp49l : dialog { label = "children_fixed_height". } //dialog name //give it a label //define a row //fix the height //define a list box //give it a name //give it a label //make a list //define height . label = "List Box 1". list = "1\n2\n3\n4".children_fixed_height Children_Fixed_Height Not Set. : list_box { key = "lb1". : row { children_fixed_height = true. Children_Fixed_Height Set to True. Possible values are: true or false. This attribute specifies the default height for all the tiles in a cluster. It does not override a child's height attribute if it is specified. label = "List Box 2". } } ok_cancel . } //define a list box //give it a name //give it a label //make a list //define height //end row //predefined OK/Cancel button //end dialog . height = 5. list = "A\nB\nC\nD".: list_box { key = "lb2". This attribute specifies the default width for all the tiles in a cluster. } : edit_box { key = "eb2". It does not override a child's width attribute if it is specified. label = "Edit Box 2". value = "Edit Box 2". label = "Edit Box 1". width = 10. : edit_box { key = "eb1". Children_Fixed_Width Set to True. } } spacer. Possible values are: true or false. value = "Edit Box 1". : column { children_fixed_width = true. //dialog name //give it a label //define column //fix the width //define an edit box //give it a name //give it a label //give it a width //fill it //end edit box //define an edit box //give it a name //give it a label //give it a width //fill it //end edit box //end column //a spacer . (default: false) DCL Code Sample lisp49m : dialog { label = "children_fixed_width".children_fixed_width Children_Fixed_Width Not Set. width = 10. } //predefined OK/Cancel/Help button //end dialog .ok_cancel_help . } spacer. list = "A\nB\nC\nD\nE\nF\nG\nH\nI". fixed_height = true. If true and the user double-clicks the tile. ok_cancel . DCL Code Sample lisp49n : dialog { label = "allow_accept". (Normally the O. : list_box { key = "lb1". } //dialog name //give it a label //define a list box //give it a name //give it a label //make a list //define height //fix the height //allow double click //end list box //add a space //predefined OK/Cancel button //end dialog . the tile who's key is "accept" is selected.K.allow_accept Allow_Accept. allow_accept = true. tile. height = 5.) This attribute defaults to false. This attribute specifies whether a particular tile can be double-clicked. label = "Double Click a Letter:". Aspect_Ratio set to 2.aspect_ratio Aspect_Ratio set to 0. width = 5. } spacer.5. This attribute specifies the ratio of the width of an image to it's height. (width divided by height.0 .0. aspect_ratio = 2. default: none. } //dialog name //give it a label //define image tile //give it a name //set width //set the ratio //center the image //end image //add a space //predefined OK/Cancel button //end dialog . the tile is fitted to the size of the image.) If zero (0. DCL Code Sample lisp49o : dialog { label = "aspect_ratio" . : image { key = "im1" .0. ok_cancel . alignment = centered.0). Possible values are floating-point values. and the max_value. label = "Slot &Length (O/All Slot)" . Default value: One-tenth of the total range. min_value = 0. max_value = 100. This attribute specifies the value that the slider will increase or decrease by. } //dialog name //give it a label //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //define big increment //end slider //predefined OK/Cancel button //end dialog . : edit_box { key = "eb1" . DCL Code Sample lisp49p : dialog { label = "big_increment" . This value must be between the min_value. big_increment = 5. edit_width = 6 . if you click the slider bar. value = "50". } : slider { key = "myslider" . } ok_cancel .big_increment Big Increment. children_alignment = centered. : row { children_fixed_height = true.color Color. (Usually equivalent to 0) AutoCAD colour = 0 (black) (appears light on a black background) AutoCAD colour = 1 (red) AutoCAD colour = 2 (yellow) AutoCAD colour = 3 (green) AutoCAD colour = 4 (cyan) AutoCAD colour = 5 (blue) AutoCAD colour = 6 (magenta) AutoCAD colour = 7 (white) Appears black on a light background Note: If an image tile containing slides is blank when you first display it.0 . } //dialog name //give it a label //begin row //fix the height //define image tile //give it a name //and a height //and now a width //set the colour //end image . This attribute specifies the background (fill) colour of an image. : image { key = "im1" . try changing it's color attribute to graphics_background or graphics_foreground.0 . color = green. height = 1. DCL Code Sample lisp49q : dialog { label = "color" . width = 2. Possible values are an integer or reserved word (default: 7) specified as an AutoCAD colour number or as one of the symbolic names as shown in the following table: dialog_line dialog_foreground dialog_background graphics_background black red yellow green cyan blue magenta white graphics_foreground Current dialog box line colour Current dialog box foreground colour Current dialog box background colour Current background of the AutoCAD graphics screen. 0 .0 . width = 2. } //define image tile //give it a name //and a height //and now a width //set the colour //end image //define image tile //give it a name //and a height //and now a width //set the colour //end image //define image tile //give it a name //and a height //and now a width //set the colour //end image //define image tile //give it a name //and a height //and now a width //set the colour //end image //end row //predefined OK/Cancel button //end dialog . } : image { key = "im4" . color = red.0 . height = 1. height = 1.0 . height = 1.0 . } } ok_cancel .0 . width = 2. width = 2. } : image { key = "im3" . } : image { key = "im5" . color = blue.0 . color = dialog_line.0 . width = 2.: image { key = "im2" . height = 1. color = cyan. } //dialog name //give it a label //define edit box //give it a name //give it a label //limit characters //end edit box //define edit box //give it a name //give it a label //limit characters //end edit box //add a space //predefined OK/Cancel button //end dialog ". : edit_box { key = "eb1". : edit_box { key = "eb2". This attribute specifies the maximum number of characters a user is allowed to enter into an edit box. Possible value is an integer. label = "Input CD Key edit_limit = 4.edit_limit Edit Limit. Default: 132. DCL Code Sample lisp49r : dialog { label = "edit_limit" . } spacer. ok_cancel . label = "Serial Number". } . edit_limit = 8. edit_limit = 8. Default: None. label = "Serial Number". edit_width = 8. ok_cancel . : edit_box { key = "eb2". DCL Code Sample lisp49s : dialog { label = "edit_width" . } . : edit_box { key = "eb1". Possible values are an integer or a real number. } spacer. label = "Input CD Key edit_limit = 4. This attribute specifies the width in character units of an edit box. } //dialog name //give it a label //define edit box //give it a name //give it a label //limit characters //fix the width //end edit box //define edit box //give it a name //give it a label //limit characters //fix the width //end edit box //add a space //predefined OK/Cancel button //end dialog ".edit_width Edit Width. edit_width = 4. } ok_cancel .8".6\n M30\t60LG\tGr. height = 6. fixed_height = true. DCL Code Sample lisp49ai : dialog { label = "fixed_width_font" . 4. allow_accept = true. label = "Select Bolt Type:".6\n M8\t45LG\tGr. This attribute is valid only for Windows/NT. This attribute specifies whether a 'list_box' or 'popup_list' will display text in a fixed pitch font. 8.8\n M16\t30LG\tGr. 4. fixed_width_font = true. 8.8\n M12\t35LG\tGr.fixed_width_font Dialogue with Fixed Width Font. This allows for easier spacing and tab alignment of columns. list = "M20\t40LG\tGr. 8. : list_box { key = "lb1". } //dialog name //give it a label //define a list box //give it a name //give it a label //allow double clicking //set tabs //define the list //give it a height //fix the height //give it a width //fix the font width //end list box //predefined OK/Cancel button //end dialog . tabs = "8 16 24". width = 20. ok_cancel . } spacer. This attribute specifies the the key of the tile within the dialogue box that receives the initial focus when the dialogue is started. alignment = centered. alignment = centered.initial_focus Initial Focus. Possible value is a quoted string. } : button { key = "btn2". } //dialog name //give it a label //set focus //define button //give it a name //give it a label //center it //fix the width //end button //define button //give it a name //give it a label //center it //fix the width //end button //add a space //predefined OK/Cancel button //end dialog . Default: None. initial_focus = "btn1". fixed_width = true. DCL Code Sample lisp49t : dialog { label = "intial_focus" . fixed_width = true. label = "Initial Focus". label = "Not Focused". : button { key = "btn1". Default: false. This attribute specifies whether the button is selected when the user presses the cancel key (Esc or Ctrl+C). is_cancel = true. Only one button in a dialogue box can have the 'is_cancel' attribute set to true. key = "cancel". } } //dialog name //give it a label //define button //give it a label //give it a name //fix the width //make it the cancel key //end button //end dialog . DCL Code Sample lisp49v : dialog { label = "is_cancel" . Possible values are true or false. : button { label = "Press Escape".is_cancel Is_Cancel. fixed_width = true. key = "accept". (normally "Enter"). fixed_width = true. Default: false. is_default = true. Possible values are true or false. DCL Code Sample lisp49w : dialog { label = "is_default" . } } //dialog name //give it a label //define button //give it a label //give it a name //fix the width //make it the default key //end button //end dialog .is_default Is_Default. : button { label = "Press Enter". This attribute specifies whether the button is the default button selected ("pushed") when the user presses the accept key. Only one button in a dialogue box can have the 'is_default' attribute set to true. The label can specify the mnemonic for a tile by preceding one of the letters of the label with the ampersand character. Possible value is a quoted string. } //dialog name //give it a label //define a boxed column //give it a label //define a toggle //give it a label //give it a name //end toggle //define a toggle //give it a label //give it a name //end toggle //define button //give it a label //fix the width //align right //end button //end boxed column //add a space //predefined OK/Cancel button //end dialog . : boxed_column { label = "This is a Label". : toggle { label = "Another Label". " ". This attribute specifies the the text displayed within tile.label A couple of Labels. key = "tog2". ok_cancel . } : toggle { label = "Label with a &Mnemonic". (&) DCL Code Sample lisp49x : dialog { label = "label" . Default: A blank string. key = "tog1". fixed_width=true. } } spacer. alignment=centered. } : button { label="A Button Label". . list = "A\nF\nR\nA\nL\nI\nS\nP". DCL Code Sample lisp49y : dialog { label = "layout" . it increases from bottom to top. } : column { : slider { layout = vertical. //dialog name //give it a label //define row //define list box //give it a name //the list //give it a height //fix the height //give it a width //fix the width //end list box //define column //define slider //make it vertical //give it a name //upper value //lower value //initial value //define big increment . fixed_width = true. For horizontal sliders. key = "myslider" . For vertical sliders.layout Vertical Layout. the value increases from left to right. value = "5". min_value = 0. : row { : list_box { key = "lb1". width = 4. max_value = 10. fixed_height = true. height = 8. This attribute specifies the orientation of a slider. Possible values are horizontal or vertical. big_increment = 2. Default : horizontal. } : edit_box { key = "eb1" . } //align it right //end slider //define edit box //give it a name //2 characters only //end edit box //end column //end row //predefined OK button //end dialog . edit_width = 2 . } } } ok_only .alignment = right. list List with Tabs. This attribute specifies the initial set of lines (choices) to be placed in the 'popup_list' or 'list_box'. Possible value is a quoted string. Default : None. Lines are separated by a new line symbol (\n). Tab characters (\t) can occur within each line. DCL Code Sample lisp49z : dialog { label = "list" ; : list_box { key = "lb1"; list = "A\tB\nC\tD\nE\tF\nG\tH"; tabs = "2 4"; height = 5; width = 6; fixed_width = true; fixed_height = true; alignment = centered; } spacer ; ok_cancel ; } //dialog name //give it a label //define list box //give it a name //the list //set tabs //give it a height //give it a width //fix the width //fix the height //center it //end list box //add a space //predefined OK/Cancel button //end dialog max_value Maximum Value = 50. This attribute specifies the upper range of values that a slider returns. Default: 10000. This value must be no greater than 32767. DCL Code Sample lisp49aa : dialog { label = "max_value" ; : edit_box { key = "eb1" ; label = "Slot &Length (O/All Slot)" ; edit_width = 6 ; } : slider { key = "myslider" ; max_value = 50; min_value = -50; value = "50"; big_increment = 5; } : row { : text { value = "Min Value"; } : text { value = " "; } : text { value = "Max Value"; } //dialog name //give it a label //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //define big increment //end slider //define row //define text //give it a value //end text //define text //give it a value //end text //define text //give it a value //end text } ok_cancel ; } //end row //predefined OK/Cancel button //end dialog min_value Minimum Value = -50. This attribute specifies the lower range of values that a slider returns. Default: 0. This value must be no less than -32767. The 'min_value' can be greater than the 'max_value'. This reverses the order in which these values appear on the screen. (Platform dependent). DCL Code Sample lisp49ab : dialog { label = "min_value" ; : edit_box { key = "eb1" ; label = "Slot &Length (O/All Slot)" ; edit_width = 6 ; } : slider { key = "myslider" ; max_value = 50; min_value = -50; value = "50"; big_increment = 5; } : row { : text { value = "Min Value"; } : text { value = " "; } : text { value = "Max Value"; } //dialog name //give it a label //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //define big increment //end slider //define row //define text //give it a value //end text //define text //give it a value //end text //define text //give it a value //end text } ok_cancel ; } //end row //predefined OK/Cancel button //end dialog multiple_select Multiple Select. This attribute specifies whether multiple items in a 'list_box' can be selected (and highlighted) at the same time. Possible values are true or false. Default : false. The method of selected multiple items is platform dependent. (On Windows you hold down the 'Ctrl' or 'Shift' key whilst selecting.) DCL Code Sample lisp49ac : dialog { label = "multiple_select" ; //dialog name //give it a label : list_box { //define list box key = "lb1"; //give it a name list = "Steel\nConcrete\nWood\nPlastic";//the list height = 5; //give it a height width = 10; //give it a width fixed_width = true; //fix the width fixed_height = true; //fix the height alignment = centered; //center it multiple_select = true; //allow multiple select } //end list box spacer ; ok_cancel ; } //add a space //predefined OK/Cancel button //end dialog edit_limit = 6. This attribute specifies the character to be used as a password character.password_char Password Character. If the 'password_char' is specified. that character is displayed in the 'edit_box' instead of the characters entered by the user. ok_cancel . key = "eb1". password_char = "*". : edit_box { label = "Enter Password". DCL Code Sample lisp49ad : dialog { label = "password_char" . It alters only the display of the characters in the 'edit_box'. width = 6. fixed_width = true. The use of this attribute has no effect on the retrieval of the value entered by the user. } spacer . } //dialog name //give it a label //define edit box //give it a label //give it a name //password character //give it a width //limit to six characters //fix the width //end edit box //add a space //predefined OK/Cancel button //end dialog . : edit_box { key = "eb1" . and the max_value. big_increment = 5. DCL Code Sample lisp49ae : dialog { label = "small_increment" . This value must be between the min_value. small_increment = 2.small_increment Small Increment. min_value = 0. } //dialog name //give it a label //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //define small increment //define big increment //end slider //predefined OK/Cancel button //end dialog . label = "Slot &Length (O/All Slot)" . } : slider { key = "myslider" . if you click the slider bar arrow controls located at each end of the slider. Default value: One-hundredth of the total range. value = "50". } ok_cancel . edit_width = 6 . This attribute specifies the value that the slider will increase or decrease by. max_value = 100. height = 6.6\n M30\t60LG\tGr. Possible value is a quoted string containing integers or floating-point numbers separated by spaces. 8. 4. Default = None. label = "Select Bolt Type:". 8. list = "M20\t40LG\tGr. This attribute specifies the placement of tabs in character width units. allow_accept = true.8\n M12\t35LG\tGr. 8.8". } ok_cancel . 4. These values are used for vertically aligning columns of text in a 'popup_list' or 'list_box'.tabs List Box with Tabs.6\n M8\t45LG\tGr. } //dialog name //give it a label //define a list box //give it a name //give it a label //allow double clicking //set tabs //define the list //give it a height //fix the height //end list box //predefined OK/Cancel button //end dialog . DCL Code Sample lisp49af : dialog { label = "tabs" . fixed_height = true. : list_box { key = "lb1". tabs = "8 16 24".8\n M16\t30LG\tGr. : list_box { key = "lb1". tabs = "5 16 24". list = "Jan\t28th\t1999\n Feb\t16th\t1997\n September\t6th\t2000\n Jul\t14th\t1998\n Mar\t12th\t1996". label = "Choose Date:". allow_accept = true. DCL Code Sample lisp49ag : dialog { label = "tab_truncate" .tab_truncate List Box with Tabs NOT Truncated. This attribute specifies whether the text in a 'list_box' or 'popup_list' is truncated if it is larger than the associated tab stop. Default : false. Possible values are true or false. List Box with Tabs Truncated. tab_truncate = true. //dialog name //give it a label //define a list box //give it a name //give it a label //allow double clicking //set tabs //define list //truncate . fixed_height = true. } //give it a height //fix the height //end list box //predefined OK/Cancel button //end dialog . } ok_cancel .height = 6. value = "1". width = 6. The meaning of a tile's value varies depending on the kind of tile. The value of a tile can change at run-time. DCL Code Sample lisp49ah : dialog { label = "value" . : edit_box { key = "eb1". } : toggle { key = "tog2". label = "This has nothing". with user input or 'set_tile' calls. width = 6.value Value. fixed_width = true. label = "This has no value". } spacer. : toggle { key = "tog1". value = "100. } : edit_box { key = "eb2". fixed_width = true. label = "This has value". This attribute specifies the initial value of a tile. Possible value is a quoted string.00". //dialog name //give it a label //define edit box //give it a name //give it a value //give it a label //give it a width //fix the width //end edit box //define edit box //give it a name //give it a label //give it a width //fix the width //end edit box //define a space //define a toggle //give it a name //give it a value //give it a label //end toggle //define a toggle //give it a name //give it a label . label = "This has a value". } spacer; ok_cancel ; } //end toggle //define a space //predefined OK/Cancel button //end dialog Dialog Box Default Data When a user works with a dialog box he enters the required data and then exits the dialog box. On returning to the dialog box, the data contained in the box should be updated to reflect the users previous entries. Most users tend to re-use the same set of data time after time, and it can be very frustrating to have to retype the same data every time you re-open a dialog box. To create defaults in a dialog box is a 5 step process : Retrieve the global variables containing the default data. If they do not exist, create some default data. Display the default data to the user. Allow the user to change the data. When the user exits the dialog box, store this data as defaults. The following application will show you how to do this : DCL Coding: test1 : dialog { label = "Dialog Defaults" ; : row { : toggle { key = "tog1"; label = "On or Off"; } : toggle { key = "tog2"; label = "Left or Right"; } } spacer; : edit_box { key = "eb2" ; //dialog name //give it a label //define row //define toggle //give it a name //give it a label //end toggle //define toggle //give it a name //give it a label //end toggle //end row //put in a space //define edit box //give it a name label = "&Enter a couple of Letters" ; //give it a label } //end edit box spacer; : edit_box { key = "eb1" ; label = "&Value of Slider" ; edit_width = 6 ; } : slider { key = "myslider" ; max_value = 100; min_value = 0; value = "50"; small_increment = 2; big_increment = 5; } spacer; ok_cancel ; } //put in a space //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //define small increment //define big increment //end slider //put in a space //predefined OK/Cancel button //end dialog AutoLISP Coding: (defun C:test1 () ;define function ;;;***************************************************** ;;;This section sets up the dialog box default settings. (if (not lngth) ;if no default (setq lngth "50.0") ;set a default value );if ;slider and slider edit box value (if (not letters) ;if no default (setq letters "ABC") ;set default value );if (if (not toggle1) ;if no default (setq toggle1 "1") ;set default value );if (if (not toggle2) ;if no default (setq toggle2 "0") ;set default value );if ;;;********************************************************** (setq dcl_id (load_dialog "test1.dcl")) ;load dialog (if (not (new_dialog "test1" dcl_id) ;test for dialog );not (exit) ;exit if no dialog );if ;;;****************************************************************** ;;;This section sets the dialog box default values (set_tile "tog1" toggle1) ;set toggle (set_tile "tog2" toggle2) ;set toggle (set_tile "eb2" letters) ;put data into edit box (set_tile "eb1" lngth) ;put data into edit box (set_tile "myslider" lngth) ;set the slider ;;;********************************************************************* ;;;This section retrieves the dialog box values (action_tile "myslider" ;if user moves slider "(slider_action $value $reason)") ;pass arguments to slider_action (action_tile "eb1" ;if user enters slot length "(ebox_action $value $reason)") ;pass arguments to ebox_action (defun slider_action (val why) ;define function (if (or (= why 2) (= why 1)) ;check values (set_tile "eb1" val))) ;update edit box (defun ebox_action (val why) ;define function (if (or (= why 2) (= why 1)) ;check values (set_tile "myslider" val))) ;update slider (action_tile "tog1" ;if toggle 1 selected "(setq toggle1 $value)" ;get the value );action_tile (action_tile "tog2" ;if toggle 2 selected "(setq toggle2 $value)" ;get the value );action_tile (action_tile "accept" ;if O.K. pressed "(progn ;do the following (setq lngth (get_tile \"eb1\")) ;get the edit box value (setq letters (get_tile \"eb2\")) ;get the slider value (done_dialog) (setq userclick T))" ;close dialog, set flag );action tile (action_tile "cancel" ;if cancel button pressed "(done_dialog) (setq userclick nil)" ;close dialog and clear flag );action_tile ;;******************************************************************** (start_dialog) ;start dialog (unload_dialog dcl_id) ;unload (if userclick ;check O.K. was selected (alert (strcat "You Selected: " lngth " and " letters)) ;display the Data );if userclick (princ) );defun (princ) Now load and run this application in AutoCAD. Enter some new data and exit the dialog box. Run the application again. You will find that the dialog box has 'remembered' your entries. Now this is fine, but if you start a new drawing, or exit AutoCAD these values will be lost. Let's rewrite this routine to "permanently" remember these values. To do this we will make use of Application Data. Here's how : DCL Coding: test2 : dialog { label = "Dialog Defaults" ; : row { : toggle { key = "tog1"; label = "On or Off"; } : toggle { key = "tog2"; label = "Left or Right"; //dialog name //give it a label //define row //define toggle //give it a name //give it a label //end toggle //define toggle //give it a name //give it a label small_increment = 2. : edit_box { key = "eb1" . } //put in a space //define edit box //give it a name //give it a label //6 characters only //end edit box //define slider //give it a name //upper value //lower value //initial value //define small increment //define big increment //end slider //put in a space //predefined OK/Cancel button //end dialog AutoLISP Coding: (defun C:test2 () . //give it a label } //end edit box spacer.. max_value = 100. //end toggle //end row //put in a space : edit_box { //define edit box key = "eb2" .define function . edit_width = 6 . big_increment = 5.} } spacer..ACADR14.if it is nil (progn . ok_cancel .. (setq lngth (getcfg "AppData/CadKen/default1")) .get the apllication data (if (= lngth nil) . } spacer.do the following .CFG file. min_value = 0..This section retrieves the default data from the . } : slider { key = "myslider" .***************************************************** . //give it a name label = "&Enter a couple of Letters" . label = "&Value of Slider" ... value = "50". get the aplication data (if (= letters nil) .do the following (setcfg "AppData/CadKen/default2" "ABC") .set the default data (setq toggle1 (getcfg "AppData/CadKen/default3")) .if (setq toggle2 (getcfg "AppData/CadKen/default4")) .set the default data (setq letters (getcfg "AppData/CadKen/default2")) .retrieve the default data ).if it is nil (progn .do the following (setcfg "AppData/CadKen/default3" "1") .progn ).if it is nil .progn ).get the apllication data (if (= toggle2 nil) .if it is nil (progn .if (setq toggle1 (getcfg "AppData/CadKen/default3")) .0") .progn ).set the default data (setq lngth (getcfg "AppData/CadKen/default1")) .get the apllication data (if (= toggle1 nil) .(setcfg "AppData/CadKen/default1" "50.retrieve the default data ).if (setq letters (getcfg "AppData/CadKen/default2")) .retrieve the default data ). if user moves slider "(slider_action $value $reason)") .load dialog (if (not (new_dialog "test2" dcl_id) .if ..retrieve the default data ).if .test for dialog ).set toggle (set_tile "tog2" toggle2) .exit if no dialog ).progn ).********************************************************************* ...put data into edit box (set_tile "eb1" lngth) .set toggle (set_tile "eb2" letters) .pass arguments to slider_action (action_tile "eb1" ..do the following (setcfg "AppData/CadKen/default4" "0") ..not (exit) ...(progn ..if user enters slot length ..This section retrieves the dialog box values (action_tile "myslider" ..put data into edit box (set_tile "myslider" lngth) .set the slider .dcl")) .This section sets the dialog box default values (set_tile "tog1" toggle1) .****************************************************************** .set the default data (setq toggle2 (getcfg "AppData/CadKen/default4")) .********************************************************** (setq dcl_id (load_dialog "test2. check values (set_tile "eb1" val))) .update slider (action_tile "tog1" .update edit box (defun ebox_action (val why) .pass arguments to ebox_action (defun slider_action (val why) .action tile .get the edit box value (done_dialog) (setq userclick T))" .close dialog.action_tile (action_tile "tog2" .get the value ).do the following (setq lngth (get_tile \"eb1\")) .K.action_tile (action_tile "accept" .if toggle 2 selected "(setq toggle2 $value)" . pressed "(progn .if O.if toggle 1 selected "(setq toggle1 $value)" .define function (if (or (= why 2) (= why 1)) . set flag ).get the value ).define function (if (or (= why 2) (= why 1)) .get the slider value (setq letters (get_tile \"eb2\")) ."(ebox_action $value $reason)") .check values (set_tile "myslider" val))) . ..display the Data ).K. . Now exit AutoCAD.store the data (setcfg "AppData/CadKen/default3" toggle1) .. Re-enter AutoCAD and load and run the application again. was selected . Again..store the data (setcfg "AppData/CadKen/default4" toggle2) .store the data (setcfg "AppData/CadKen/default2" letters) .This section stores the data into the AACDR14.defun (princ) Now load and run this application.start dialog (unload_dialog dcl_id) ..(action_tile "cancel" .unload (if userclick .if userclick (princ) )...close dialog and clear flag ).store the data (alert (strcat "You Entered: " lngth " and " letters)) ..CFG file and displays ..******************************************************************* .them to the user.******************************************************************** (start_dialog) . Your values have been retained.if cancel button pressed "(done_dialog) (setq userclick nil)" .progn ). (progn (setcfg "AppData/CadKen/default1" lngth) .action_tile ..check O. add some new values and exit the dialog. . displaying the data in a custom dialog box. and it displays all attributes whether you want them or not. O. Personally. Now. This dialog should appear : . we must select the attribute we would like to edit. type "Addat" and press enter again. if you have a lot of attributes you need to page your way through numerous dialogs before reaching the attribute you want to edit.Attributes and Dialog Boxes When you want to edit attributes in AutoCAD most of us use the "Attedit" command. Now. at the command prompt type (load "Addat") and then enter. but it's enough to give you the general idea. fire up AutoCAD and open the drawing Attab. what do we need to do? Find the block containing the attribute data.dwg. I think this dialog leaves a lot to be desired. As well. Then the "Edit Attribute" dialog box appears which allows us to add or change the values of our attribute. Update the attribute data with the new information entered into the dialog box. Allow the user to change the data if he so wishes. Firstly. In this tutorial we are going to have a look at extracting attribute data from a block. Right.K. Alright.) Extract the attribute data and display it in a dialog box. I admit that it's not much of a title block. and then updating the attribute data on exit. You cannot customise it in any way. (Why select it when we can get AutoCAD to find it for us. key = "eb3". Clever hey? You can expand on this routine as much as you like using the following coding as a template. } : edit_box { label = "D&ate". you can split your data over multiple dialog boxes. Hint : You don't have to display all the attribute data stored in a block. key = "eb4". key = "eb2".Change some of the data and then press the "OK" button. one for revisions. eg. one for reference drawings. All the data though is contained in one attribute. edit_width = 30. One for title block. . edit_width = 30. : edit_box { label = "&Drawing Number". } : edit_box { label = "Drawn &By". } : edit_box { label = "&Revision". Only display what you want the user to modify. Here's the coding. As well. edit_width = 30. DCL code first : attab : dialog { label = "Drawing Title Block". key = "eb1". The title block data should be updated. etc. Attab. http://www.na . } ok_cancel . .Type ATTAB to run.") (defun c:attab (/) .utility and may be used by anyone for any purpose entirely at their own risk.This application will extract attributes from a block and display them in a . AfraLisp .edit_width = 30.afralisp. edit_width = 30. . :text_part { label = "AfraLisp . .dcl and Attab.com".required and must be within the AutoCAD search path.afralisp.. The attributes will then be updated. .com . afralisp@afralisp.
[email protected]://www.dialog box..Usage : Open Attab.dwg then load and run Attab.com..All Tutorials and Code are provided "as-is" for purposes of instruction and . . .Please respect the intellectual rights of others.dwg are .lsp. } } And now the AutoLisp coding with plenty of in-line comments to assist you : .. ... key = "eb5".CODING STARTS HERE .com .first find all the blocks with attributes in the drawing (setq ss1 (ssget "X" '((0 .******************************************************************************* (prompt "\nATTAB Loaded.No responsibility will be taken for any direct or indirect consequences .resulting from or associated with the use of these Tutorials or Code.All material provided here is unsupported and without warranty of any kind. "INSERT")(66 .******************************************************************************* .. } : edit_box { label = "&Title". 1)))) . .******************************************************************************* . do the following (progn .display the dialog (ddisplay) .if there are blocks (if ss1 .if it is..extract the block name (while (< count emax) (setq en (ssname ss1 count) ed (entget en) blkn (dxf 2 ed) ) .and set the found flag (setq count emax found T ) .while .if ).set up the counter (setq count 0 emax (sslength ss1) ) .cannot find our block (alert "\nDrawing Sheet has No Attributes \n Use Manual Edit" ) ).it's not our block. increment the counter .if ).and loop (setq count (1+ count)) ).check if it is our block (if (= "attab-info" blkn) . switch off the counter .progn .if we find our block (if found . .get the fourth attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .get the second attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .get the revision (setq eb2 (dxf 1 edata)) .load the dialog (setq dcl_id (load_dialog "attab.if .get the block entity data (setq edata (entget en)) .check it exists (if (not (new_dialog "attab" dcl_id)) (exit) ).finish clean (princ) ).get the name (setq eb3 (dxf 1 edata)) ..there are no blocks in the drawing (alert "\nIncorrect Drawing Sheet \n Use Manual Edit" ) ).dcl")) .if .get the drawing number (setq eb1 (dxf 1 edata)) .********************************************************** (defun ddisplay (/) ..get the third attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .defun .get the first attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) . retrieve the tile values (action_tile "accept" (strcat "(progn (setq eb1a (get_tile \"eb1\"))" "(setq eb2a (get_tile \"eb2\"))" "(setq eb3a (get_tile \"eb3\"))" "(setq eb4a (get_tile \"eb4\"))" "(setq eb5a (get_tile \"eb5\"))" " (done_dialog)(setq userclick T))" ) ) .unload the dialog (unload_dialog dcl_id) .get the fifth attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .if OK was selected (if userclick (progn .get the date (setq eb4 (dxf 1 edata)) .put the info into the dialog (set_tile "eb1" eb1) (set_tile "eb2" eb2) (set_tile "eb3" eb3) (set_tile "eb4" eb4) (set_tile "eb5" eb5) .if cancel selected exit (action_tile "cancel" "(done_dialog) (setq userclick nil)" ) ..set the focus to the drawing number (mode_tile "eb1" 2) .get the title (setq eb5 (dxf 1 edata)) .start the dialog (start_dialog) .if OK selected. .change the list with the new values.update the attribute (entmod el) .get the block entity data (setq edata (entget en)) . if any (setq el (subst (cons 1 eb2a) (assoc 1 edata) edata)) .update the attribute (entmod el) .get the first attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .get the second attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .regen the drawing (command "REGEN") ). if any (setq el (subst (cons 1 eb3a) (assoc 1 edata) edata)) .update the attribute (entmod el) .change the list with the new values.change the list with the new values.get the fourth attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .progn . if any (setq el (subst (cons 1 eb5a) (assoc 1 edata) edata)) .change the list with the new values.change the list with the new values.get the third attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) . if any (setq el (subst (cons 1 eb4a) (assoc 1 edata) edata)) . if any (setq el (subst (cons 1 eb1a) (assoc 1 edata) edata)) .get the fifth attribute entity list (setq edata (entget (entnext (dxf -1 edata)))) .update the attribute (entmod el) .update the attribute (entmod el) . .defun ..load clean (princ) ..defun ..CODING ENDS HERE Please note that there is no error checking in this routine and I have left all variables as global to assist you in checking their values whilst you are analyzing the code..if (princ) )..********************************************************** .).*********************************************************** (defun dxf (code elist) (cdr (assoc code elist)) ).********************************************************** . .. ")) (vl-file-delete fname) (princ) ).defun ----------------------(defun val1 () (if (= (get_tile "name") "Enter Name Here") (progn (set_tile "error" "You must enter a name!") (mode_tile "name" 2) ). let's take a simple AutoLisp dialog example and tweek the coding a little bit so that our program "writes" the DCL file for us.DCL without the DCL File Have you ever wanted to load and run a DCL file without having a DCL file? "What are you talking about Kenny?" Easy.LSP"..") (defun C:TEST_DCL3 ( / dcl_id fn fname) (vl-load-com) (create_dialog) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "temp" dcl_id)) (exit ) )..if (set_tile "name" "Enter Name Here") (mode_tile "name" 2) (action_tile "name" "(setq name $value)") (action_tile "age" "(setq age $value)") (action_tile "accept" "(val1)") (start_dialog) (unload_dialog dcl_id) (alert (strcat "Your name is " name "\nand you are " age " years of age.. Copy and paste the following and save it as "TEST_DCL3.AUTOLISP CODING STARTS HERE (prompt "\nType TEST_DCL3 to run. ..progn (val2) . if ).progn (done_dialog) ). alignment = centered. edit_limit = 30.Please Try Again!!") (mode_tile "age" 2) ). : edit_box { label = \"Enter Your Name :\". } }" fn) (close fn) ). mnemonic = \"A\". edit_width = 30. label = \"OK\".AUTOLISP CODING ENDS HERE Notice that there is no DCL file this time. edit_limit = 3. mnemonic = \"N\". key = \"name\".). is_default = true.defun ------------------(defun val2 () (if (< (atoi (get_tile "age")) 1) (progn (set_tile "error" "Invalid Age . value = \"22\". alignment = centered. Now load and run it.if ). } : button { key = \"accept\".defun ------------------(defun create_dialog () (setq fname (vl-filename-mktemp "dcl.defun (princ) . key =\"age\".dcl")) (setq fn (open fname "w")) (write-line "temp : dialog { label = \"Test Dialog No 3\". fixed_width = true. } : edit_box { label = \"Enter Your Age :\". alignment = centered. } : errtile { width = 34. edit_width = 3. . (Hey. At the same time. . what did I tell you? We've just loaded and ran a DCL file even though we haven't got one!!! You could now compile this into a FAS file if you wished. we'll have a closer look at this truly amazing phenomenon and have a closer look at the coding. a FAS file with DCL . we'll get really clever and design ourselves a "Variable-auto-self-sizingDialog-Box-without-a-DCL-file".See.cool!) In the next section. ..na ..Usage : . .load the visual lisp extensions (vl-load-com) . .Type DCLATT at the command prompt to run. We will be using a lot of Visual Lisp coding within this routine as I also want to demonstrate one method of extracting and updating attributes using Visual Lisp.May 2002 .The dialog box will be created "on the fly" with the relevant .to suit the number of attributes within .number of edit boxes . The dialog will be created "on-the-fly" and the number of attribute edit boxes will be determined by the number of attributes.Dependencies : None that I know of.Limitations : Will only edit a certain number of attributes.the block.This program is for demonstration and tutorial purposes only.Variable-auto-self-sizing-Dialog-Box-without-a-DCL-file In this tutorial we're going to create an application that extracts attributes from a block and displays these attributes within a dialog box. .The new attribute data will then be retrieved from the dialog .. . --------------------------------------------.DCLATT.com ------------------------------------------...and the block updated.Not much in the way of error checking I'm afraid.Select any block containing attributes.LSP . using Visual Lisp will extract attributes from .http://www.") (defun c:dclatt ( / theblock thelist n taglist txtlist lg fname fn nu dcl_id l relist) . . .afralisp. -------------------------------------------. .System dependent.the attributes.Load by typing (load "DCLATT") at the command prompt.I don't recommend more than 10. .a block and display them in a dialog box. --------------------------------------------.This program.Replace any of the values in the text boxes to updated . ------------------------------------------------------------------------------------------(prompt "\nType DCLATT to run.
[email protected]'ve had up to 14 on my display.Written by Kenny Ramage . . No further explanation is necessary as the coding is well commented : .com. do the following (progn .progn .check if it's a block (if (= (vlax-get-property theblock 'ObjectName) "AcDbBlockReference") .get the attributes (getatt theblock) . inform the user (alert "This Block has No Attributes!! . do the following (progn .if (princ) ).Please try again..if ).if it has attributes. inform the user (alert "This is not a Block!! .") ).if it is.No attributes.progn .convert to vl object (setq theblock (vlax-ename->vla-object theblock)) .") ).create the dialog (create_dialog) .check if it has attributes (if (= (vlax-get-property theblock 'HasAttributes) :vlax-true) .Please try again.update the attributes (upatt) ).get the entity and entity name (setq theblock (car (entsel))) .run the dialog (run_the_dialog) .defun ------------------------ .it's not a block. open it to write (setq fn (open fname "w")) .write the dialog header coding (write-line "temp : dialog { label = \"Edit Attributes\"." fn) .defun ------------------------(defun create_dialog () .setq ).create the edit boxes (write-line ": edit_box {" fn) (setq l (strcat "\"" "eb" (itoa nu) "\"" ".get the text attribute data txtlist (cons (vla-get-textString n) txtlist) .(defun getatt (enam) .create a temp DCL file (setq fname (vl-filename-mktemp "dcl.foreach .start the loop to create the edit boxes (repeat lg .get the tag attribute data (setq taglist (cons (vla-get-tagString n) taglist) .process each attribute (foreach n thelist .retrieve the attributes (setq thelist (vlax-safearray->list (variant-value (vla-getattributes enam)))) .reset the incremental control number (setq nu 0) .how many attributes? lg (length taglist) ).reverse the lists (setq taglist (reverse taglist) txtlist (reverse txtlist)) ).dcl")) .")) (write-line (strcat "key = " l) fn) (setq l (nth nu taglist)) . ") fn) (write-line "alignment = centered.if (mode_tile "eb0" 2) . }" fn) .close the temp DCL file (close fn) ).repeat .if the OK button is selected (action_tile "accept" "(retatt)") . edit_width = 20.unload the dialog (unload_dialog dcl_id) .(write-line (strcat "label = " "\"" l "\"" ".ok and cancel button (write-line "ok_only.increment the counter (setq nu (1+ nu)) ). }" fn) .load the dialog file and definition (setq dcl_id (load_dialog fname)) (if (not (new_dialog "temp" dcl_id)) (exit ) ).delete the temp DCL file (vl-file-delete fname) ).defun -----------------------------(defun run_the_dialog () .reset the increment counter (setq nu 0) start the loop (repeat lg .defun --------------------------(defun retatt () .start the dialog (start_dialog) .") fn) (setq l (nth nu txtlist)) (write-line (strcat "value = " "\"" l "\"" ". clean loading (princ) --------------------------..increment the counter (setq nu (1+ nu)) ).update the attribute (vla-put-textstring (nth nu thelist) (nth nu relist)) . .reset the increment counter (setq nu 0) .start the loop (repeat lg .repeat (setq relist (reverse relist)) .retrieve the tile value (setq l (get_tile (strcat "eb" (itoa nu)))) .update the block (vla-update theblock) ).LSP --------------------------- Now you need to create 2 or three blocks containing a varying number of attributes.defun ----------------------------------------(defun upatt () .End of ATTDCL.repeat .add it to the list (setq relist (cons l relist)) .increment the counter (setq nu (1+ nu)) ).close the dialog (done_dialog) ).defun --------------------------. The dialog will appear. . but this time select "Attribute No 2".LSP" and select "Attribute No 1". You dialog should appear looking like this with three attribute edit boxes : Now run the program again. Clever hey? A big thanks to Stig Madsen for the help with the coding in this project. but this time with four attribute edit boxes.Here's what mine look like : Load and run "DCLATT. (DCL) .DCL Model **Click on Relevant Image for Coding** **Click here for DCL Coding** This model lays out the function sequence required to design a dialogue box using AutoLisp and Dialogue Control Language. ..... It first checks that the ..dcl")) ..Back to Model.....dialogue box definition. ..define function .not (exit) .AutoLisp Coding (defun C:lisp51 () . (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) .set default pipe schedule for edit box (setq index "3") .This section assigns all the default values of the dialogue .DCL file has been loaded.. ..box into their relevant variables.This section initializes the dialogue box tiles..************************************************************** .. (if (not (new_dialog "lisp51" dcl_id) ...************************************************************** . DCL Model .exit if no dialog )..if ...************************************************************** .for inspection purposes.load dialog ..test for dialog ).set default for radius radio buttons (setq schedule "40") ..contained within the DCL file.This section loads the relevant DCL file containing the .************************************************************** .default list for pipe diameter list box (setq rad "Long") ..set default pipe size index .variables have been left as local ...This section loads the particular dialogue box definition . (setq dcl_id (load_dialog "lisp51.. if radio button No 2 selected "(setq rad \"Medium\") .. pre-selects an item in the .action_tile .store radius (mode_tile \"eb1\" 2)" ...*************************************************************** .action_tile (action_tile "rb2" .open the list box (mapcar 'add_list names) .puts a default value into the edit box.coding...if radio button No 1 selected "(setq rad \"Long\") ..set focus to edit box ).set focus to edit box ). (action_tile "rb1" ..."Remember the coding that is in this section.. When start_dialog . and a tile is selected.add the names to the list box (end_list) ....store radius (mode_tile \"eb1\" 2)" . In effect. proceed with the relevant ...It fills the list box.is called...switch on radio button No 1 (set_tile "eb1" "40") .. switches on the default radio button and .This section retrieves the values that the user selects .end the list box (set_tile "lb1" "3") . (start_list "lb1") .list box.set default pipe schedule ..or inputs. what we are saying here is : .select 4th item in list box (set_tile "rb1" "1") .. If the O.if radio button No 3 selected "(setq rad \"Short\") .******************************************************************* ..K.get the schedule entered (setq index (atof (get_tile \"lb1\"))) .if O.******************************************************************** . (if userclick ...This section displays the dialogue box and waits for user input (start_dialog) ...action tile (action_tile "cancel" .close dialog.(action_tile "rb3" .. lower flag ). set flag ).... tile was selected.K.close dialog. process the users input values.set focus to edit box ). pressed "(setq schedule (get_tile \"eb1\")) ..if cancel button pressed "(done_dialog) (setq userclick nil)" .action_tile (action_tile "accept" ..get the index of the pipe diameter entered (done_dialog) (setq userclick T)" ..action_tile .******************************************************************* .start dialog .store radius (mode_tile \"eb1\" 2)" .unload .done_dialogue has been called. so the dialogue can be unloaded (unload_dialog dcl_id) . .******************************************************************** ...defun (princ) .string the results together and display them to the user ).do the following (setq index (fix index)) .load clean ..if .progn ).finish clean ).******************************************************************* (princ) .if OK selected (progn ..convert index to integer (setq size (nth index names)) .get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) . .default list for pipe diameter list box (setq rad "Long") . (setq dcl_id (load_dialog "lisp51..************************************************************** ..************************************************************** .DCL file has been loaded.contained within the DCL file...set default for radius radio buttons (setq schedule "40") .. DCL Model .set default pipe schedule for edit box (setq index "3") .************************************************************** .for inspection purposes....if .AutoLisp Coding (defun C:lisp51 () . It first checks that the .box into their relevant variables.dialogue box definition.set default pipe size index . (if (not (new_dialog "lisp51" dcl_id) . .dcl")) .test for dialog )...not (exit) .....This section loads the relevant DCL file containing the ...************************************************************** ...define function .This section loads the particular dialogue box definition .. (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) .load dialog .This section assigns all the default values of the dialogue ...variables have been left as local ..Back to Model.exit if no dialog )... puts a default value into the edit box. proceed with the relevant . . what we are saying here is : .. and a tile is selected.It fills the list box.. (start_list "lb1") .if radio button No 1 selected "(setq rad \"Long\") .end the list box (set_tile "lb1" "3") .This section retrieves the values that the user selects .coding..set focus to edit box ).store radius (mode_tile \"eb1\" 2)" .add the names to the list box (end_list) ....set focus to edit box ).or inputs...switch on radio button No 1 (set_tile "eb1" "40") ..select 4th item in list box (set_tile "rb1" "1") .if radio button No 2 selected "(setq rad \"Medium\") ..is called.This section initializes the dialogue box tiles..action_tile (action_tile "rb2" .. switches on the default radio button and .set default pipe schedule .. (action_tile "rb1" .."Remember the coding that is in this section. When start_dialog .*************************************************************** ..open the list box (mapcar 'add_list names) ... pre-selects an item in the ....action_tile .list box. In effect..store radius (mode_tile \"eb1\" 2)" . done_dialogue has been called.If the O.******************************************************************* . lower flag ).if O...if radio button No 3 selected "(setq rad \"Short\") .close dialog.******************************************************************* .******************************************************************** . . pressed "(setq schedule (get_tile \"eb1\")) ..get the schedule entered (setq index (atof (get_tile \"lb1\"))) . tile was selected..action tile (action_tile "cancel" ..action_tile ...K.action_tile (action_tile "accept" .(action_tile "rb3" ..start dialog .set focus to edit box ). set flag ).close dialog.. process the users input values.. so the dialogue can be unloaded (unload_dialog dcl_id) ...This section displays the dialogue box and waits for user input (start_dialog) .get the index of the pipe diameter entered (done_dialog) (setq userclick T)" .if cancel button pressed "(done_dialog) (setq userclick nil)" .K.unload .store radius (mode_tile \"eb1\" 2)" . defun (princ) .do the following (setq index (fix index)) ..load clean .get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) .******************************************************************* (princ) .progn )..finish clean ).string the results together and display them to the user )..if .(if userclick .******************************************************************** .convert index to integer (setq size (nth index names)) .if OK selected (progn .. exit if no dialog ). DCL Model ..load dialog ...contained within the DCL file.dcl")) .set default pipe size index . It first checks that the ....This section loads the particular dialogue box definition .default list for pipe diameter list box (setq rad "Long") . (setq dcl_id (load_dialog "lisp51.....set default for radius radio buttons (setq schedule "40") .....box into their relevant variables.DCL file has been loaded.set default pipe schedule for edit box (setq index "3") ..This section assigns all the default values of the dialogue .************************************************************** ..AutoLisp Coding (defun C:lisp51 () .************************************************************** .test for dialog ).define function .dialogue box definition.. (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) . (if (not (new_dialog "lisp51" dcl_id) .variables have been left as local ..for inspection purposes...This section loads the relevant DCL file containing the .if . ...************************************************************** ..not (exit) .Back to Model. .coding. When start_dialog ... ... and a tile is selected. (start_list "lb1") ... pre-selects an item in the .switch on radio button No 1 (set_tile "eb1" "40") .add the names to the list box (end_list) .. In effect... proceed with the relevant ..store radius (mode_tile \"eb1\" 2)" ."Remember the coding that is in this section.end the list box (set_tile "lb1" "3") .if radio button No 1 selected "(setq rad \"Long\") ...action_tile (action_tile "rb2" .It fills the list box.... (action_tile "rb1" . what we are saying here is : .This section retrieves the values that the user selects ...select 4th item in list box (set_tile "rb1" "1") .puts a default value into the edit box..*************************************************************** .set default pipe schedule .open the list box (mapcar 'add_list names) .store radius (mode_tile \"eb1\" 2)" .************************************************************** ..set focus to edit box .set focus to edit box ).This section initializes the dialogue box tiles..or inputs.if radio button No 2 selected "(setq rad \"Medium\") .. switches on the default radio button and .is called..list box. If the O. lower flag ).action_tile .action tile (action_tile "cancel" .action_tile (action_tile "rb3" .unload .get the schedule entered (setq index (atof (get_tile \"lb1\"))) ...store radius (mode_tile \"eb1\" 2)" .. ... tile was selected..close dialog.This section displays the dialogue box and waits for user input (start_dialog) . so the dialogue can be unloaded (unload_dialog dcl_id) . pressed "(setq schedule (get_tile \"eb1\")) ..******************************************************************* .K.if O. set flag )..). process the users input values..set focus to edit box ).******************************************************************* .close dialog.get the index of the pipe diameter entered (done_dialog) (setq userclick T)" ..K..if radio button No 3 selected "(setq rad \"Short\") .******************************************************************** ..action_tile (action_tile "accept" .done_dialogue has been called.start dialog .if cancel button pressed "(done_dialog) (setq userclick nil)" . do the following (setq index (fix index)) .get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) ..defun (princ) ..if OK selected (progn .progn ).(if userclick .******************************************************************* (princ) .if .string the results together and display them to the user ).load clean .convert index to integer (setq size (nth index names)) .******************************************************************** .finish clean )... This section initializes the dialogue box tiles....************************************************************** . DCL Model ... (if (not (new_dialog "lisp51" dcl_id) .This section loads the relevant DCL file containing the .************************************************************** ...load dialog .... It first checks that the .......This section assigns all the default values of the dialogue . .test for dialog ).************************************************************** .dialogue box definition.contained within the DCL file.define function . (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) ... .variables have been left as local ....set default for radius radio buttons (setq schedule "40") ...AutoLisp Coding (defun C:lisp51 () .dcl")) .set default pipe schedule for edit box (setq index "3") .************************************************************** .Back to Model..default list for pipe diameter list box (setq rad "Long") .This section loads the particular dialogue box definition . (setq dcl_id (load_dialog "lisp51.DCL file has been loaded.for inspection purposes....box into their relevant variables.exit if no dialog ).set default pipe size index .if .not (exit) . (start_list "lb1") .set focus to edit box ).coding... In effect....or inputs.select 4th item in list box (set_tile "rb1" "1") .."Remember the coding that is in this section..puts a default value into the edit box..if radio button No 1 selected "(setq rad \"Long\") . (action_tile "rb1" .It fills the list box.This section retrieves the values that the user selects .if radio button No 2 selected "(setq rad \"Medium\") .list box... proceed with the relevant . pre-selects an item in the ....open the list box (mapcar 'add_list names) . what we are saying here is : ..*************************************************************** .store radius (mode_tile \"eb1\" 2)" . and a tile is selected.set default pipe schedule .store radius (mode_tile \"eb1\" 2)" . switches on the default radio button and .add the names to the list box (end_list) .action_tile .is called.action_tile (action_tile "rb2" . When start_dialog ....end the list box (set_tile "lb1" "3") ...switch on radio button No 1 (set_tile "eb1" "40") .set focus to edit box ). set flag ).K. lower flag ). process the users input values.K.action tile (action_tile "cancel" ..This section displays the dialogue box and waits for user input (start_dialog) . (if userclick . pressed "(setq schedule (get_tile \"eb1\")) ..store radius (mode_tile \"eb1\" 2)" .if radio button No 3 selected "(setq rad \"Short\") ..******************************************************************* .action_tile .If the O.close dialog..done_dialogue has been called.get the schedule entered (setq index (atof (get_tile \"lb1\"))) ..start dialog .close dialog. so the dialogue can be unloaded (unload_dialog dcl_id) . tile was selected..if cancel button pressed "(done_dialog) (setq userclick nil)" ...get the index of the pipe diameter entered (done_dialog) (setq userclick T)" .******************************************************************* .unload .(action_tile "rb3" ..******************************************************************** .set focus to edit box )...if O.action_tile (action_tile "accept" .. .do the following (setq index (fix index)) .get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) .load clean .string the results together and display them to the user )...if OK selected (progn .progn )..if .convert index to integer (setq size (nth index names)) .finish clean ).defun (princ) .******************************************************************** .******************************************************************* (princ) .. dialogue box definition.for inspection purposes..Back to Model.************************************************************** ...This section initializes the dialogue box tiles. (setq dcl_id (load_dialog "lisp51.... (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) .This section loads the particular dialogue box definition . ..define function ......exit if no dialog )...set default pipe schedule for edit box (setq index "3") .dcl")) .contained within the DCL file..not (exit) ......if .load dialog .box into their relevant variables.AutoLisp Coding (defun C:lisp51 () .. DCL Model ..variables have been left as local .************************************************************** .************************************************************** .. It first checks that the .************************************************************** . (if (not (new_dialog "lisp51" dcl_id) .. ..set default for radius radio buttons (setq schedule "40") .This section loads the relevant DCL file containing the ..default list for pipe diameter list box (setq rad "Long") ..This section assigns all the default values of the dialogue .set default pipe size index .test for dialog ).DCL file has been loaded. .set focus to edit box ).coding.This section retrieves the values that the user selects .puts a default value into the edit box.store radius (mode_tile \"eb1\" 2)" .end the list box (set_tile "lb1" "3") .*************************************************************** ."Remember the coding that is in this section..set focus to edit box ). In effect.list box.if radio button No 2 selected "(setq rad \"Medium\") .open the list box (mapcar 'add_list names) . (action_tile "rb1" ......is called...set default pipe schedule ...or inputs.if radio button No 1 selected "(setq rad \"Long\") .... and a tile is selected. pre-selects an item in the . switches on the default radio button and ...select 4th item in list box (set_tile "rb1" "1") .action_tile (action_tile "rb2" .. (start_list "lb1") ..add the names to the list box (end_list) . proceed with the relevant . When start_dialog .. what we are saying here is : .action_tile .It fills the list box.store radius (mode_tile \"eb1\" 2)" .switch on radio button No 1 (set_tile "eb1" "40") . This section displays the dialogue box and waits for user input (start_dialog) .******************************************************************* .store radius (mode_tile \"eb1\" 2)" .If the O..get the index of the pipe diameter entered (done_dialog) (setq userclick T)" .unload .start dialog ...******************************************************************* .(action_tile "rb3" .done_dialogue has been called.if radio button No 3 selected "(setq rad \"Short\") .action_tile (action_tile "accept" .. tile was selected.action tile (action_tile "cancel" ..if cancel button pressed "(done_dialog) (setq userclick nil)" .. process the users input values...close dialog. (if userclick .******************************************************************** .set focus to edit box )... lower flag ).if O.K.K. set flag ).get the schedule entered (setq index (atof (get_tile \"lb1\"))) .close dialog. pressed "(setq schedule (get_tile \"eb1\")) . so the dialogue can be unloaded (unload_dialog dcl_id) .action_tile ... .progn ).defun (princ) .convert index to integer (setq size (nth index names)) .******************************************************************** ..do the following (setq index (fix index)) .string the results together and display them to the user ).get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) .if OK selected (progn ...******************************************************************* (princ) .finish clean )..if .load clean . . (setq dcl_id (load_dialog "lisp51.box into their relevant variables. .Back to Model..not (exit) .set default for radius radio buttons (setq schedule "40") .************************************************************** . It first checks that the .************************************************************** .DCL file has been loaded.************************************************************** ..default list for pipe diameter list box (setq rad "Long") ..dialogue box definition...dcl")) ..if ... DCL Model .define function . .test for dialog ).set default pipe size index ...************************************************************** .contained within the DCL file......load dialog .This section initializes the dialogue box tiles....This section assigns all the default values of the dialogue .for inspection purposes..set default pipe schedule for edit box (setq index "3") .AutoLisp Coding (defun C:lisp51 () ..variables have been left as local ...This section loads the particular dialogue box definition .. (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) ..This section loads the relevant DCL file containing the .exit if no dialog ).. (if (not (new_dialog "lisp51" dcl_id) .. .set focus to edit box ).This section retrieves the values that the user selects .coding.....switch on radio button No 1 (set_tile "eb1" "40") ...or inputs.action_tile (action_tile "rb2" ...puts a default value into the edit box.*************************************************************** . pre-selects an item in the ...if radio button No 2 selected "(setq rad \"Medium\") . what we are saying here is : . (start_list "lb1") . When start_dialog .select 4th item in list box (set_tile "rb1" "1") . In effect..end the list box (set_tile "lb1" "3") .."Remember the coding that is in this section..open the list box (mapcar 'add_list names) .set default pipe schedule ..set focus to edit box ). switches on the default radio button and .action_tile .is called.if radio button No 1 selected "(setq rad \"Long\") ..list box..store radius (mode_tile \"eb1\" 2)" .add the names to the list box (end_list) . proceed with the relevant . (action_tile "rb1" .It fills the list box.store radius (mode_tile \"eb1\" 2)" . and a tile is selected... .K..close dialog. lower flag ).******************************************************************** ..action tile (action_tile "cancel" .unload .action_tile (action_tile "accept" . set flag ).If the O.******************************************************************* .if O.get the schedule entered (setq index (atof (get_tile \"lb1\"))) ..action_tile .get the index of the pipe diameter entered (done_dialog) (setq userclick T)" ....if radio button No 3 selected "(setq rad \"Short\") .done_dialogue has been called. pressed "(setq schedule (get_tile \"eb1\")) . (if userclick ..close dialog... so the dialogue can be unloaded (unload_dialog dcl_id) ..******************************************************************* .store radius (mode_tile \"eb1\" 2)" . process the users input values. tile was selected.if cancel button pressed "(done_dialog) (setq userclick nil)" .This section displays the dialogue box and waits for user input (start_dialog) .set focus to edit box )..start dialog .(action_tile "rb3" .K. convert index to integer (setq size (nth index names)) ..get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) .load clean .string the results together and display them to the user ).******************************************************************** ..******************************************************************* (princ) ..progn ).if .do the following (setq index (fix index)) ..if OK selected (progn ..finish clean ).defun (princ) . if .....box into their relevant variables.This section loads the relevant DCL file containing the .default list for pipe diameter list box (setq rad "Long") ..contained within the DCL file. (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) ..... (setq dcl_id (load_dialog "lisp51.variables have been left as local .************************************************************** ....set default pipe schedule for edit box (setq index "3") . It first checks that the ..This section initializes the dialogue box tiles..dialogue box definition..not (exit) .dcl")) .This section loads the particular dialogue box definition ..************************************************************** .AutoLisp Coding (defun C:lisp51 () .set default pipe size index ...************************************************************** . .. DCL Model .set default for radius radio buttons (setq schedule "40") .define function . (if (not (new_dialog "lisp51" dcl_id) .DCL file has been loaded. .test for dialog )...Back to Model..exit if no dialog ).This section assigns all the default values of the dialogue .....************************************************************** ..load dialog .for inspection purposes. end the list box (set_tile "lb1" "3") .. switches on the default radio button and ..select 4th item in list box (set_tile "rb1" "1") .store radius (mode_tile \"eb1\" 2)" .set focus to edit box ). When start_dialog .. what we are saying here is : .coding..action_tile .or inputs.action_tile (action_tile "rb2" ....puts a default value into the edit box.It fills the list box..list box.is called..*************************************************************** ...add the names to the list box (end_list) . proceed with the relevant ."Remember the coding that is in this section.... In effect. pre-selects an item in the . and a tile is selected. (action_tile "rb1" .store radius (mode_tile \"eb1\" 2)" .. (start_list "lb1") .switch on radio button No 1 (set_tile "eb1" "40") ...if radio button No 1 selected "(setq rad \"Long\") .set focus to edit box )..if radio button No 2 selected "(setq rad \"Medium\") .This section retrieves the values that the user selects .set default pipe schedule .open the list box (mapcar 'add_list names) .. done_dialogue has been called. tile was selected. process the users input values.K.This section displays the dialogue box and waits for user input (start_dialog) .if O.******************************************************************* ..******************************************************************* .(action_tile "rb3" ..set focus to edit box )..close dialog. lower flag ).if cancel button pressed "(done_dialog) (setq userclick nil)" .... so the dialogue can be unloaded (unload_dialog dcl_id) .close dialog...action_tile (action_tile "accept" ..get the index of the pipe diameter entered (done_dialog) (setq userclick T)" .action tile (action_tile "cancel" . pressed "(setq schedule (get_tile \"eb1\")) .get the schedule entered (setq index (atof (get_tile \"lb1\"))) ..if radio button No 3 selected "(setq rad \"Short\") .action_tile .start dialog .******************************************************************** .unload .. (if userclick ..If the O. set flag ).store radius (mode_tile \"eb1\" 2)" .K. ..string the results together and display them to the user ).load clean .progn )..if ..******************************************************************* (princ) .finish clean ).if OK selected (progn .get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) ..do the following (setq index (fix index)) .defun (princ) .******************************************************************** .convert index to integer (setq size (nth index names)) . not (exit) . .load dialog ..set default pipe size index .exit if no dialog ).set default pipe schedule for edit box (setq index "3") .This section loads the relevant DCL file containing the ..for inspection purposes.test for dialog ). (setq names '("50 NB" "60 NB" "70 NB" "80 NB" "90 NB" "100 NB" "125 NB" "150 NB" "200 NB" "250 NB")) ...default list for pipe diameter list box (setq rad "Long") ...dcl")) ..************************************************************** ..contained within the DCL file.... (setq dcl_id (load_dialog "lisp51. It first checks that the .variables have been left as local ...... .if .Back to Model. (if (not (new_dialog "lisp51" dcl_id) .This section assigns all the default values of the dialogue ..AutoLisp Coding (defun C:lisp51 () .DCL file has been loaded.This section loads the particular dialogue box definition ...This section initializes the dialogue box tiles..************************************************************** .. DCL Model ..dialogue box definition....************************************************************** .************************************************************** .set default for radius radio buttons (setq schedule "40") .box into their relevant variables..define function .. switches on the default radio button and .set default pipe schedule .if radio button No 2 selected "(setq rad \"Medium\") ... (start_list "lb1") .puts a default value into the edit box. pre-selects an item in the .*************************************************************** .. and a tile is selected...or inputs.action_tile (action_tile "rb2" ...action_tile .end the list box (set_tile "lb1" "3") .set focus to edit box ).store radius (mode_tile \"eb1\" 2)" .coding."Remember the coding that is in this section.. proceed with the relevant ...set focus to edit box )..switch on radio button No 1 (set_tile "eb1" "40") .add the names to the list box (end_list) .store radius (mode_tile \"eb1\" 2)" .. what we are saying here is : . In effect.list box.if radio button No 1 selected "(setq rad \"Long\") ..is called...This section retrieves the values that the user selects . When start_dialog ..open the list box (mapcar 'add_list names) ... (action_tile "rb1" ..It fills the list box.select 4th item in list box (set_tile "rb1" "1") . . tile was selected. set flag ).action tile (action_tile "cancel" .action_tile . (if userclick .action_tile (action_tile "accept" .close dialog.unload ..done_dialogue has been called.******************************************************************** .get the schedule entered (setq index (atof (get_tile \"lb1\"))) .. lower flag )..start dialog . process the users input values.K.close dialog..get the index of the pipe diameter entered (done_dialog) (setq userclick T)" .******************************************************************* ..if cancel button pressed "(done_dialog) (setq userclick nil)" . pressed "(setq schedule (get_tile \"eb1\")) .This section displays the dialogue box and waits for user input (start_dialog) ..store radius (mode_tile \"eb1\" 2)" .if radio button No 3 selected "(setq rad \"Short\") ...set focus to edit box )..If the O.K.(action_tile "rb3" .******************************************************************* .. so the dialogue can be unloaded (unload_dialog dcl_id) ..if O. finish clean ).defun (princ) .get the pipe size from the list (alert (strcat "You Choose a : " size"\n" rad " : Radius" "\n" "Sched : " schedule " Pipe Bend")) ...******************************************************************* (princ) ..string the results together and display them to the user )..load clean .if OK selected (progn .******************************************************************** .do the following (setq index (fix index)) ..convert index to integer (setq size (nth index names)) .progn ).if . label = "Pipe Schedule :" . DCL Model .DCL Coding lisp51 : dialog { label = "Pipe Bends" . ok_cancel .Back to Model.. } spacer . } //dialog name //give it a label //define a row //align to top //define list box //give it a name //end list box //define radio column //give it a label //define radio button //give it a label //give it a name //end radio button //define radio button //give it a label //give it a name //end radio button //define radio button //give it a label //give it a name //end radio button //end radio column //end row //add a space //define edit box //give it a name //give it a label //end edit box //add a space //predefined OK/Cancel button //end dialog . } } } spacer . key = "rb3" . } : radio_button { label = "Medium". : popup_list { key = "lb1" . key = "rb1" . : row { children_alignment = top . : radio_button { label = "Long" . } : radio_column { label = "Radius :". : edit_box { key = "eb1" ... } : radio_button { label = "Short". key = "rb2" . vbdesign..Pete.dsxcad.http://www.The Journal .http://www..) If I've forgotten someone..afralisp..com VBA Expresso ..http://www.com/appinatt BedRock .dczaland.com CopyPaste Code .contractcaddgroup. (Thanks for everything pal.http://www.net/cgi-bin/ikonboard.http://www. And a BIG thank you to Marie and Jessie Rath for at least trying to control that reprobate Randall..http://www.http://www.com .cgi CAD Encoding .copypastecode.net Contract CADD Group . Frank Zander for his generosity and support. hey life's tough. Some of the best Links on the Web : AfraLisp .http://www.. The lads from BedRock .bedrockband.com DsxCad .Acknowledgments and Links A big thanks to : My wife Heather.http://www.com QnA~Tnt . My Mum and Dad EVERYONE at VBA Expresso. Eddie and Mike.com VB Design .cadencoding.vbdesign..