In my DCL, I have 3 editboxes
If I have text in each box, everything is ok. If say I only had text in tailtext1 editbox and the other two were blank, the routine works but at the end of the routine ate the prompt I get this:
Unknown command "WELD". Press F1 for help.
Unknown command "WELD". Press F1 for help.
Those go away if there is values/text in each of the 3 editboxes.
How can I fix this?
tailtex1, tailtext2 & tailtext3 form 3 separate lines of texty in mtext. Each one is an editbox in my DCL
Below is the code line that I have:
(command "-MTEXT" (list (+ (car pt3) (* dim_scale 1.75)) (cadr pt3)) "J" "ML" "W" "0" tailtext1 tailtext2 tailtext3 "")
Thanks,
ADK
@Anonymous wrote:In my DCL, I have 3 editboxes
If I have text in each box, everything is ok. If say I only had text in tailtext1 editbox and the other two were blank, the routine works but at the end of the routine ate the prompt I get this:
Unknown command "WELD". Press F1 for help.
Unknown command "WELD". Press F1 for help.
Those go away if there is values/text in each of the 3 editboxes.
How can I fix this?
tailtex1, tailtext2 & tailtext3 form 3 separate lines of texty in mtext. Each one is an editbox in my DCL
Below is the code line that I have:
(command "-MTEXT" (list (+ (car pt3) (* dim_scale 1.75)) (cadr pt3)) "J" "ML" "W" "0" tailtext1 tailtext2 tailtext3 "")
Thanks,
ADK
(command "-MTEXT" (list (+ (car pt3) (* dim_scale 1.75)) (cadr pt3)) "J" "ML" "W" "0" tailtext1
(if (> (strlen tailtext2) 0) tailtext2) (if (> (strlen tailtext3) 0) tailtext3) "")
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Close but not quite... the result of either tailtest2 or tailtext3 strlen=0 is nil which is not an acceptable command response (nil will cancel the command). The code for text lines 2 and 3 should be nested (if...)s with nested (command...)s so that the valid text string(s) are input if they exist and an empty string is issued to complete the command in any case :
(if (AND (> (strlen tailtext2) 0) (> (strlen tailtext3) 0)) (COMMAND tailtext2 tailtext3 "") (if (> (strlen tailtext2) 0) (COMMAND tailtext2 "") ""))
perhaps tthis.
You might also consider the possibility that tailtext1 is a blank string
A call to a sub would look like this (using francishc's code)
(defun ins_mtext (pt scl st1 st2 st3) (if (> (strlen st1) 0) (progn (command "-MTEXT" (list (+ (car pt) (* scl 1.75)) (cadr pt)) "J" "ML" "W" "0" st1) (if (AND (> (strlen st2) 0) (> (strlen st3) 0)) (COMMAND st2 st3) (if (> (strlen st2) 0) (COMMAND st2) )) (command "") ) ) (princ) )
Usage
(ins_mtext pt3 dim_scale tailtext1 tailtext2 tailtext3)
Hope this helps
But then again, if your routine only have this one function (to write the MTEXT) you dont need to test for tailtext1 , if nil dont run the sub, if its a part of a bigger routine a call to a sub is a better option.
I would hope that the dialog has a cancel button for when the user decides not to place the Mtext. I would not expect the user to continue if s/he did not put any text in the first field; however, it is very good form to account for every possible condition that may occur... Because they will all surely occur sooner or later. Good suggestion pbejse!