DCL error: string too long on input

DCL error: string too long on input

msarqui
Collaborator Collaborator
2,922 Views
8 Replies
Message 1 of 9

DCL error: string too long on input

msarqui
Collaborator
Collaborator

Hi everyone.

 

I am having problems with a dialog box that I am creating.
The visual lisp editor gives me this : error: string too long on input:
If I remove two rows, it will work, but actually I need to have 16 rows...
I have seen many dialog boxes with more information than mine and I do not understand how it is possible to achieve this.

Thank you in advance for any help.


p.s. I did not put the action_tile yet for the purpose of getting help here before. I will do this latter.

 

(defun c:test ( / d o)
(if	(and
	(setq d (vl-filename-mktemp nil nil ".dcl"))
	(setq o (open d "w"))
	(write-line
	(strcat "InfoSec:dialog{key=\"Title\";label=\"INFORMATION\";
:column{
:row{
:text{label=\" \";width=4;}
:text{label=\"ID prod.\";width=10;}
:text{label=\"Sct#\";width=1;}
:text{label=\"Technology\";width=21;}
:text{label=\"Prod. model\";width=20;}
:text{label=\"Hight\";width=3;}
:text{label=\"Level\";width=5;}
:text{label=\"MDT\";width=5;}}

:row{
:radio_button{key=\"radio1\";}
:edit_box {key=\"eid1\";edit_width=7;}
:edit_box {key=\"esc1\";edit_width=3;}
:edit_box {key=\"ete1\";width=20;}
:edit_box {key=\"emo1\";width=18;}
:edit_box {key=\"eaz1\";edit_width=4;}
:edit_box {key=\"eha1\";edit_width=7;}
:edit_box {key=\"emd1\";edit_width=3;}}

:row{
:radio_button{key=\"radio2\";}
:edit_box{key=\"pid1\";edit_width=7;}
:edit_box{key=\"psc1\";edit_width=3;}
:edit_box{key=\"pte1\";width=20;}
:edit_box{key=\"pmo1\";width=18;}
:edit_box{key=\"paz1\";edit_width=4;}
:edit_box{key=\"pha1\";edit_width=7;}
:edit_box{key=\"pmd1\";edit_width=3;}}

:row{
:radio_button{key=\"radio3\";}
:edit_box {key=\"eid2\";edit_width=7;}
:edit_box {key=\"esc2\";edit_width=3;}
:edit_box {key=\"ete2\";width=20;}
:edit_box {key=\"emo2\";width=18;}
:edit_box {key=\"eaz2\";edit_width=4;}
:edit_box {key=\"eha2\";edit_width=7;}
:edit_box {key=\"emd2\";edit_width=3;}}

:row{
:radio_button{key=\"radio4\";}
:edit_box{key=\"pid2\";edit_width=7;}
:edit_box{key=\"psc2\";edit_width=3;}
:edit_box{key=\"pte2\";width=20;}
:edit_box{key=\"pmo2\";width=18;}
:edit_box{key=\"paz2\";edit_width=4;}
:edit_box{key=\"pha2\";edit_width=7;}
:edit_box{key=\"pmd2\";edit_width=3;}}

:row{
:radio_button{key=\"radio5\";}
:edit_box {key=\"eid3\";edit_width=7;}
:edit_box {key=\"esc3\";edit_width=3;}
:edit_box {key=\"ete3\";width=20;}
:edit_box {key=\"emo3\";width=18;}
:edit_box {key=\"eaz3\";edit_width=4;}
:edit_box {key=\"eha3\";edit_width=7;}
:edit_box {key=\"emd3\";edit_width=3;}}

:row{
:radio_button{key=\"radio6\";}
:edit_box{key=\"pid3\";edit_width=7;}
:edit_box{key=\"psc3\";edit_width=3;}
:edit_box{key=\"pte3\";width=20;}
:edit_box{key=\"pmo3\";width=18;}
:edit_box{key=\"paz3\";edit_width=4;}
:edit_box{key=\"pha3\";edit_width=7;}
:edit_box{key=\"pmd3\";edit_width=3;}}

spacer;
:row{fixed_width=true;alignment=centered;
:button{key=\"Save\";label=\"&Save\";is_default=true;}}

:row{:column{fixed_width=true;
:row{:column{spacer;
:image_button{key=\"Select\";width=3;height=1.4;color=15;}
spacer;}
:column{spacer;
:text{label=\"Select block\";}
spacer;}}}}

	}
	spacer;
	: row { fixed_width = true; alignment = centered;
	: button { key = \"OK\"; label = \"&OK\"; is_default = true; width = 12; fixed_width = true;}
	: button { key = \"Cancel\"; label = \"&Cancel\"; is_cancel = true;  width = 12; fixed_width = true;}
	}
	}"
	);strcat
	o
	);write-line
	(not (close o))
	);and
	(progn
		(if	(and (< 0 (setq id (load_dialog d)))
			(new_dialog "InfoSec" id)
			);and
			(progn
				(action_tile "OK" "(done_dialog 1)")		
				(action_tile "Cancel" "(done_dialog 0)")	
				(setq rtn (start_dialog))
				(unload_dialog id)
				(vl-file-delete d)
			);progn
			(progn
				(unload_dialog id)
				(vl-file-delete d)
			);progn
		);if
		(cond
			((eq rtn 3)
				(RefillDP)
			)
			((and radio1 (eq rtn 3))
				(IS)		
			);eq
		);cond
	);progn
);if
);defun
0 Likes
Accepted solutions (2)
2,923 Views
8 Replies
Replies (8)
Message 2 of 9

john.uhden
Mentor
Mentor

I don't think I've ever seen a "string too long" error before.

But your (strcat ............) does go on and on and on and on like Billy Joel.

How about if you use more (write-lines)?  You know, like a bite at a time rather than treating the gullet like a coal chute.

 

One technique that might save you time recoding is to..,

 

(setq wlist

  (list

  "blah"

  "blah"

  "blah"

  )

)

  and then

(mapcar '(lambda (x)(write-line x o)) wlist)

John F. Uhden

0 Likes
Message 3 of 9

Anonymous
Not applicable
Accepted solution

Agreed.  I was just coming back to post when I saw your response.  The write-line that holds the strcat was also too long, and you likely hit a limit to the number of characters.  Break the write-line (and strcat) up into more manageable chunks.  I've done it crudely below, with minimal change to msarqui's code, but it does the job.

 

------------

 

(defun c:test ( / d o)
(if (and
 (setq d (vl-filename-mktemp nil nil ".dcl"))
 (setq o (open d "w"))
 (write-line
 (strcat "InfoSec:dialog{key=\"Title\";label=\"INFORMATION\";
:column{
:row{
:text{label=\" \";width=4;}
:text{label=\"ID prod.\";width=10;}
:text{label=\"Sct#\";width=1;}
:text{label=\"Technology\";width=21;}
:text{label=\"Prod. model\";width=20;}
:text{label=\"Hight\";width=3;}
:text{label=\"Level\";width=5;}
:text{label=\"MDT\";width=5;}}

:row{
:radio_button{key=\"radio1\";}
:edit_box {key=\"eid1\";edit_width=7;}
:edit_box {key=\"esc1\";edit_width=3;}
:edit_box {key=\"ete1\";width=20;}
:edit_box {key=\"emo1\";width=18;}
:edit_box {key=\"eaz1\";edit_width=4;}
:edit_box {key=\"eha1\";edit_width=7;}
:edit_box {key=\"emd1\";edit_width=3;}}

:row{
:radio_button{key=\"radio2\";}
:edit_box{key=\"pid1\";edit_width=7;}
:edit_box{key=\"psc1\";edit_width=3;}
:edit_box{key=\"pte1\";width=20;}
:edit_box{key=\"pmo1\";width=18;}
:edit_box{key=\"paz1\";edit_width=4;}
:edit_box{key=\"pha1\";edit_width=7;}
:edit_box{key=\"pmd1\";edit_width=3;}}

:row{
:radio_button{key=\"radio3\";}
:edit_box {key=\"eid2\";edit_width=7;}
:edit_box {key=\"esc2\";edit_width=3;}
:edit_box {key=\"ete2\";width=20;}
:edit_box {key=\"emo2\";width=18;}
:edit_box {key=\"eaz2\";edit_width=4;}
:edit_box {key=\"eha2\";edit_width=7;}
:edit_box {key=\"emd2\";edit_width=3;}}
 "
 );strcat
 o
 );write-line
 (write-line
 (strcat "
:row{
:radio_button{key=\"radio4\";}
:edit_box{key=\"pid2\";edit_width=7;}
:edit_box{key=\"psc2\";edit_width=3;}
:edit_box{key=\"pte2\";width=20;}
:edit_box{key=\"pmo2\";width=18;}
:edit_box{key=\"paz2\";edit_width=4;}
:edit_box{key=\"pha2\";edit_width=7;}
:edit_box{key=\"pmd2\";edit_width=3;}}

:row{
:radio_button{key=\"radio5\";}
:edit_box {key=\"eid3\";edit_width=7;}
:edit_box {key=\"esc3\";edit_width=3;}
:edit_box {key=\"ete3\";width=20;}
:edit_box {key=\"emo3\";width=18;}
:edit_box {key=\"eaz3\";edit_width=4;}
:edit_box {key=\"eha3\";edit_width=7;}
:edit_box {key=\"emd3\";edit_width=3;}}

:row{
:radio_button{key=\"radio6\";}
:edit_box{key=\"pid3\";edit_width=7;}
:edit_box{key=\"psc3\";edit_width=3;}
:edit_box{key=\"pte3\";width=20;}
:edit_box{key=\"pmo3\";width=18;}
:edit_box{key=\"paz3\";edit_width=4;}
:edit_box{key=\"pha3\";edit_width=7;}
:edit_box{key=\"pmd3\";edit_width=3;}}

spacer;
:row{fixed_width=true;alignment=centered;
:button{key=\"Save\";label=\"&Save\";is_default=true;}}

:row{:column{fixed_width=true;
:row{:column{spacer;
:image_button{key=\"Select\";width=3;height=1.4;color=15;}
spacer;}
:column{spacer;
:text{label=\"Select block\";}
spacer;}}}}

 }
 spacer;
 : row { fixed_width = true; alignment = centered;
 : button { key = \"OK\"; label = \"&OK\"; is_default = true; width = 12; fixed_width = true;}
 : button { key = \"Cancel\"; label = \"&Cancel\"; is_cancel = true;  width = 12; fixed_width = true;}
 }
 }"
 );strcat
 o
 );write-line
 (not (close o))
 );and
 (progn
  (if (and (< 0 (setq id (load_dialog d)))
   (new_dialog "InfoSec" id)
   );and
   (progn
    (action_tile "OK" "(done_dialog 1)")  
    (action_tile "Cancel" "(done_dialog 0)") 
    (setq rtn (start_dialog))
    (unload_dialog id)
    (vl-file-delete d)
   );progn
   (progn
    (unload_dialog id)
    (vl-file-delete d)
   );progn
  );if
  (cond
   ((eq rtn 3)
    (RefillDP)
   )
   ((and radio1 (eq rtn 3))
    (IS)  
   );eq
  );cond
 );progn
);if
);defun

 

0 Likes
Message 4 of 9

msarqui
Collaborator
Collaborator

Hi guys, thanks for your help.
I am trying to do what John said, but without success. Could you guide me please?
Here is what I did. I am trying with only 2 rows for tests. I am having ** bad argument type: stringp nil

 

 

(defun c:test ( / row1 d o)
(setq row1 (list
": row {					"
": radio_button {key = \"radio1\";}		"
": edit_box { key = \"eid1\" ;edit_width = 7;}	"
": edit_box { key = \"esc1\" ;edit_width = 3;}	"
": edit_box { key = \"ete1\" ;width = 20;}	"
": edit_box { key = \"emo1\" ;width = 18;}	"
": edit_box { key = \"eaz1\" ;edit_width = 4;}	"
": edit_box { key = \"eha1\" ;edit_width = 7;}	"
": edit_box { key = \"emd1\" ;edit_width = 3;}	"
"}						"

": row {					"
": radio_button {key = \"radio2\";}		"
": edit_box {key = \"pid1\" ;edit_width = 7;}	"
": edit_box {key = \"psc1\" ;edit_width = 3;}	"
": edit_box {key = \"pte1\" ;width = 20;}	"
": edit_box {key = \"pmo1\" ;width = 18;}	"
": edit_box {key = \"paz1\" ;edit_width = 4;}	"
": edit_box {key = \"pha1\" ;edit_width = 7;}	"
": edit_box {key = \"pmd1\" ;edit_width = 3;}	"
"}						"
));setq

(if	(and
	(setq d (vl-filename-mktemp nil nil ".dcl"))
	(setq o (open d "w"))
	(write-line
	(strcat "InfoSec:dialog{key=\"Title\";label=\"INFORMATION\";
:column{

:row{
:text{label=\" \";width=4;}
:text{label=\"ID prod.\";width=10;}
:text{label=\"Sct#\";width=1;}
:text{label=\"Technology\";width=21;}
:text{label=\"Prod. model\";width=20;}
:text{label=\"Hight\";width=3;}
:text{label=\"Level\";width=5;}
:text{label=\"MDT\";width=5;}}

"(mapcar '(lambda (x)(write-line x o)) row1)"

spacer;
:row{fixed_width=true;alignment=centered;
:button{key=\"Save\";label=\"&Save\";is_default=true;}}

:row{:column{fixed_width=true;
:row{:column{spacer;
:image_button{key=\"Select\";width=3;height=1.4;color=15;}
spacer;}
:column{spacer;
:text{label=\"Select block\";}
spacer;}}}}

	}
	spacer;
	: row { fixed_width = true; alignment = centered;
	: button { key = \"OK\"; label = \"&OK\"; is_default = true; width = 12; fixed_width = true;}
	: button { key = \"Cancel\"; label = \"&Cancel\"; is_cancel = true;  width = 12; fixed_width = true;}
	}
	}"
	);strcat
	o
	);write-line
	(not (close o))
	);and
	(progn
		(if	(and (< 0 (setq id (load_dialog d)))
			(new_dialog "InfoSec" id)
			);and
			(progn
				(action_tile "OK" "(done_dialog 1)")		
				(action_tile "Cancel" "(done_dialog 0)")	
				(setq rtn (start_dialog))
				(unload_dialog id)
				(vl-file-delete d)
			);progn
			(progn
				(unload_dialog id)
				(vl-file-delete d)
			);progn
		);if
		(cond
			((eq rtn 3)
				(RefillDP)
			)
			((and radio1 (eq rtn 3))
				(IS)		
			);eq
		);cond
	);progn
);if
);defun
0 Likes
Message 5 of 9

Anonymous
Not applicable

Short on time today to look at this much, but offhand I'd be suspicious of the

 

"(mapcar '(lambda (x)(write-line x o)) row1)"

 

line in the midst of one of your strcats. 

 

<edit>

I don't mean the line itself is wrong, just in the context of a strcat it looks suspicious.

 

 

0 Likes
Message 6 of 9

scot-65
Advisor
Advisor
There are a couple things you can try...

When beginning a new line for the STRCAT, enclose these new lines with quotes
[I made this a habit after working with MODEMACRO]:

(write-line (strcat
"InfoSec:dialog{key=\"Title\";label=\"INFORMATION\"; "
":column{ "
":row{ "
":text{label=\" \";width=4;} "
etc...
))

Next, one can considerably shorten the character count of the
DCL definition by using constants.
//
// Constants
tex04 :text {width=4;}
tex10 :text {width=10;}
edi07 :edit_box{edit_width=7;}
edi03 :edit_box{edit_width=3;}
//

Therefore:
:text{label=\" \";width=4;}
:edit_box {key=\"eid1\";edit_width=7;}
Becomes:
:tex04 {label=\" \"}
:edi07 {key=\"eid1\";}

Be careful when adding comments during a write-line action.
They will need to be on a line all by itself.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 7 of 9

joselggalan
Advocate
Advocate
Accepted solution

Try this:

 

(defun c:test ( / row1 d o id rtn RetVal)
 (setq row1
       (list
	"InfoSec : dialog"
	"{"
	"  key=\"Title\";"
	"  label=\"INFORMATION\";"
	"  : column {"
	"    : row {"
	"      : text {"
	"        label=\" \";"
	"        width=4;"
	"      }"
	"      : text {"
	"        label=\"ID prod.\";"
	"        width=10;"
	"      }"
	"      : text {"
	"        label=\"Sct#\";"
	"        width=1;"
	"       }"
	"       : text {"
	"         label=\"Technology\";"
	"         width=21;"
	"       }"
	"       : text {"
	"         label=\"Prod. model\";"
	"         width=20;"
	"       }"
	"       : text {"
	"         label=\"Hight\";"
	"         width=3;"
	"       }"
	"       : text {"
	"         label=\"Level\";"
	"         width=5;"
	"       }"
	"       : text {label=\"MDT\";"
	"         width=5;"
	"       }"
	"     }"
	"     spacer;"
	"     : row {"
	"       fixed_width=true;"
	"       alignment=centered;"
	"       : button {"
	"         key=\"Save\";"
	"         label=\"&Save\";"
	"         is_default=true;"
	"       }"
	"     }"
	"     : row {"
	"       : column {"
	"         fixed_width=true;"
	"         : row {"
	"           : column {"
	"             spacer;"
	"             : image_button {"
	"               key=\"Select\";"
	"               width=3;"
	"               height=1.4;"
	"               color=15;"
	"             }"
	"             spacer;"
	"           }"
	"           : column {"
	"             spacer;"
	"             : text {"
	"               label=\"Select block\";"
	"             }"
	"             spacer;"
	"           }"
	"         }"
	"       }"
	"     }"
	"   }"
	"   spacer;"
	"   : row {"
	"     fixed_width = true;"
	"     alignment = centered;"
	"     : button {"
	"       key = \"OK\";"
	"       label = \"&OK\";"
	"       is_default = true;"
	"       width = 12;"
	"       fixed_width = true;"
	"     }"
	"     : button {"
	"       key = \"Cancel\";"
	"       label = \"&Cancel\";"
	"       is_cancel = true;"
	"       width = 12;"
	"       fixed_width = true;"
	"     }"
	"   }"
	"}"
      )
 );setq
 (setq d (vl-filename-mktemp nil nil ".dcl"))
 (setq o (open d "w"))
 (mapcar (function (lambda (x)(write-line x o))) row1)
 (close o)
 (setq id (load_dialog d))
 
 (cond
  ((not (new_dialog "InfoSec" id))
   (alert (strcat "ERROR: Open dialog fail.\n\n"
		  "[ " d " ]"))
   ;;exit
  )
  (T
   (action_tile "Save" "(done_dialog 2)")
   (action_tile "OK" "(done_dialog 1)")
   (action_tile "Cancel" "(done_dialog 0)")
   
   (setq rtn (start_dialog))
   
   (unload_dialog id)
   (cond
    ((= rtn 0) ;;cancel
     (setq RetVal nil)
     ;;etc
    ) 
    ((= rtn 1) ;;OK
     (setq RetVal T)
     ;;etc
    )
    ((= rtn 2) ;;Save
     (alert "User pulse button save")
     (setq RetVal T)
     ;;etc
    )
   )
  )
 );cond
 (vl-file-delete d)
 RetVal
);defun

(princ)

 

I do not understand this part:

  

(cond
((eq rtn 3)
(RefillDP) ) ((and radio1 (eq rtn 3))
(IS) );eq );cond

 

0 Likes
Message 8 of 9

msarqui
Collaborator
Collaborator

Hi guys,

 

I have learned some pretty good new tricks in this post to deal with DCL.

 

Thank you all!

0 Likes
Message 9 of 9

scot-65
Advisor
Advisor
And of course my favorite constants - SPACER:

swh0 :spacer {width=0.0; height=0.0;}
swh1 :spacer {width=1.0; height=1.0;}

In use:
swh0;

swh0 is used to nudge the adjoining tile or provide a space between the
last tile and the bottom of a "Boxed" tile (container).

swh1 is primarily used as an indent when combined in a ROW with other tiles.
I also use this above and below my OK_Cancel_Help row.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.