Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/23/2018 in all areas

  1. Good explanations indeed Grrr. The following attribute could also be used in lieu of that if statement. allow_accept = true;
    2 points
  2. Thanks @Grrr very very good, I loved the suggestions I will adopt these methods in my next codes!
    1 point
  3. 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 "" ?
    1 point
×
×
  • Create New...