Hi,
A good practice is to write the DCL code inside of the temporary file as multiple lines, then it would be easier to determine the error, so instead of
(write-line (strcat "string1" "string2" ... "stringN") file)
Use:
(foreach line (list "string1" "string2" ... "stringN")
(write-line line file)
)
In your code it would look like:
(foreach line
'("senha : dialog"
"{ label = \"Senha\"; key = \"efernal\"; initial_focus = \"senha\"; width = 40; fixed_width = true;"
" : spacer{ height = 0.5; }"
" : text"
" { label = \"Entre com a senha, por favor!\";"
" alignment = centered;"
" fixed_width = true;"
" }"
" : spacer { height=0.5; }"
" : edit_box"
" {"
" key = \"senha\";"
" width = 30;"
" edit_width = 30;"
" edit_limit = 25;"
" alignment = centered;"
" fixed_width = true;"
" password_char = \"*\";"
" }"
" : spacer { height=0.5; }"
" : button"
" {"
" label = \"Prosseguir\";"
" key = \"accept\";"
" is_default = true;"
" width = 16;"
" height = 2.5;"
" fixed_width = true;"
" fixed_height = true;"
" alignment = centered;"
" }"
" : spacer { height = 0.5; }"
"}"
); list
(write-line line file)
); foreach
In your case, you had a redundant bracket on the right:
"fixed_width=true;""fixed_height=true;""alignment=centered;"
"}"":spacer{height=0.5;}"
"}}" ; <<<<<--- This one
)
file
)
(close file)
You wouldn't have done this mistake if you used a proper indentation, so the "containers" that define the tile's properties could be distinct with a naked eye.
And suggestion for improvement.. well if you see yourself as a user, the obvious thing would be right after you type the password is to hit enter key, in order to attempt to login.
This can be done with checking the callback reason of the edit_box tile, so with:
(action_tile "senha" "(setq senha $value)(alert (vl-prin1-to-string $reason))")
When you type something and hit [ENTER] you w'll be alerted with a value of 1
Then lets make, when you hit enter within the edit_box, just to exit the dialog and continue checking our input:
(action_tile "senha" "(setq senha $value)(if (= 1 $reason) (done_dialog 1))")
Another thoughts.. (maybe you'll solve them, maybe someone will help you here)
What if the user accidentally invoked this command "Senha"" ? wouldn't you let him to cancel the dialog ?
In your case you'll force him to trigger an error in the program with ESC key, but then what would happen to the Tmp.dcl file ?
Would you check for an obviously wrong password like four spaces " " or an empty string "" ?