In my last post I said that I will give an explanation about the DCL file and the AutoLISP file. Here is the explanation.
The DCL File
You steady have seen the DCL file. In the DCL file the tiles of the dialog box are specified. The dialog box has got a button and a pop up list.
There is not much that can be said about the DCL file. I presume the DCL file is pretty clear to you. One thing.
For the button I have specified a height. That is done to make it easier to click on the button for selecting a text.
The AutoLISP File
The AutoLISP file works with the following six functions:
- START
- VALUE
- SELTX
- FNDDT
- DRBOX
- ENDPR
I have already talked about the START function and the ENDPR function. So I don't need to give an explanation about them again.
A call to the VALUE function is made when there is clicked on the OK button. We want to know what value is selected.
There must be clicked on the SELECT TEXT button. When that is done a call to the SELTX fucntion is made. To find what text has been selected.
But before I go any further. I must tell you about the WHILE loop in the AutoLISP program and the FL variable.
At the start if the program the FL variable gets the value two. And the WHILE loop continues as long as the value of FL is more than one.
Before the start of the WHILE loop the DCL file is loaded into the AutoLISP program. The dialog box is displayed in the WHILE loop.
At the beginning of the AutoLISP program the LS variable is specified. The variable is a list. It has the values "2" "3" "4" and "5".
The
pop up list has got values. The values are loaded into the pop up
list. See how it is done. Using the list from before.
Three
action tiles have been specified in the WHILE loop. Here they are:
Action
tile
|
Button
|
Value
|
|
|
|
CANCEL
|
Cancel
button
|
0
|
ACCEPT
|
OK
button
|
1
|
SELECT
|
Select
text button
|
2
|
The
START_DIALOG function is performed and with it the value that was
stored with the DONE_DIALOG function is given back.
The
value is given to the FL variable. If the value is zero or one, then
the WHILE loop terminates.
If
the value if the FL variable is two, then the dialog box disappears
and a text can be selected. The text is stored in the TX variable.
That
is important. The text can be selected after the SELECT TEXT button
has been clicked. The FL variable gets the value two.
The
selection of the text has to take place right after the value of the
FL variable has been found using the START_DIALOG function.
In
the first post I told you about the mistake a user can make. He can
forget to select a text and click on the OK button.
If
that happens the value of the FL variable is one and the value of the
TX variable is nil. A warning is displayed.
But
we stay in the dialog box. Because if the OK button of the warning is
clicked, then the dialog box is displayed again.
The
dialog box is also displayed again after a text has been selected.
Now the user van select what spacing he or she wants.
The
value of the FL variable is zero or one. There has been clicked on
the OK button or the Cancel button.
The
WHILE loop is terminated and the DCL file is unloaded from the
AutoLISP program using the UNLOAD_DIALOG function.
The
spacing is found in the list. The value of the selection gives the
item of the list. It is tuned into an integer with the ATOI function.
The
information about the text is found with the FNDDT function. This is
the information that is found:
- IP
- LG
- HT
- RA
See
how it is done. The entity list of the text is found and then the CDR
function and the ASSOC function is used to find the data.
When
all the information is found, the box around the text can be drawn.
Thar is done with the DRBOX function.
Do
you see that? The insertion point of the text is taken and changed
depending on the value of the spacing.
Do you like what you have read? Do you know other people, that also could be interested in what I'm saying? Could you tell them about this blog?