• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

non-functional dcl files

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
I am trying in vain to make this simple program lisp and dcl.
I tried them all, I would like to know why it doesn't work, thank you in advance.
Code:
; myyesno - question dialog with one question line
; arguments: 2
;   title$ = dialog title
;   question$ = question line
; syntax: (myyesno " my yes no" "do you like creating programs in autolisp?")
;----------------------------------------------------------------------------------------------------------
(defun c:myyesno (title$ question$ / answer$ dcl_id% return#)
  (princ "\nmyyesno")(princ)
  (setq dcl_id% (load_dialog "myyesno.dcl"))
  (new_dialog "myyesno" dcl_id%)
  (set_tile "title" title$)
  (set_tile "text1" question$)
  (action_tile "yes" "(done_dialog 1)")
  (action_tile "no" "(done_dialog 0)")
  (setq return# (start_dialog))
  (unload_dialog dcl_id%)
  (if (= return# 1)
    (setq answer$ "yes")
    (setq answer$ "no")
  );if
  (princ "\n")(princ answer$)(princ);optional
  answer$
);defun myyesno

//---------------------------------------------------------------------------------------------------------
// myyesno
// note: the width for the text1 key was determined by the syntax example and
// will need to be changed as per your requirements. also note that the buttons
// for yes and no, the added fixed_width = true;.
//---------------------------------------------------------------------------------------------------------
myyesno : dialog {
  key = "title";
  label = "";//title$ from lsp file
  spacer;
  : text {
    key = "text1";
    label = "";//question$ from lsp file
    width = 35.0;
    alignment = centered;
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "yes";
      label = "&yes";
      is_default = true;
      width = 7.92;
      fixed_width = true;
    }
    : button {
      key = "no";
      label = "&no";
      is_cancel = true;
      width = 7.92;
      fixed_width = true;
    }
  }
}//myyesno
 
after
(new_dialog "myyesno" dcl_id%)
Add to favourites
(if (new_dialog "myyesno" dcl_id%)) (exit)
if you do not find the myyesno.dcl file the program ends.
It's a rule to always follow, it avoids you to go crazy trying to find the defect that is only in missing the dcl file.
to ovviate to this or add the path in search paths or specify it, example:
"c:/mypercourse/myyesno" or "c:\\mypercourse\myyesno"
 
Thank you.
I have entered the line but I always get the error: "command: myyesno; error: missing arguments"
 
I forgot:
syntax: (c:myyesno " my yes no" "do you like creating programs in autolisp?")
scusa
 
Sorry but I can't make it work, I always get " missing subject error"
Thank you.
Code:
; myyesno - question dialog with one question line
; arguments: 2
;   title$ = dialog title
;   question$ = question line
; syntax: (myyesno " my yes no" "do you like creating programs in autolisp?")
;----------------------------------------------------------------------------------------------------------
(defun c:myyesno (title$ question$ / answer$ dcl_id% return#)
  (princ "\nmyyesno")(princ)
  (setq dcl_id% (load_dialog "myyesno.dcl"))
  (new_dialog "myyesno" dcl_id%)
  (if (not (new_dialog "c:myyesno" dcl_id%)) (exit))
  (set_tile "title" title$)
  (set_tile "text1" question$)
  (action_tile "yes" "(done_dialog 1)")
  (action_tile "no" "(done_dialog 0)")
  (setq return# (start_dialog))
  (unload_dialog dcl_id%)
  (if (= return# 1)
    (setq answer$ "yes")
    (setq answer$ "no")
  );if
  (princ "\n")(princ answer$)(princ);optional
  answer$
);defun myyesno




//---------------------------------------------------------------------------------------------------------
// myyesno
// note: the width for the text1 key was determined by the syntax example and
// will need to be changed as per your requirements. also note that the buttons
// for yes and no, the added fixed_width = true;.
//---------------------------------------------------------------------------------------------------------
myyesno : dialog {
  key = "title";
  label = "";//title$ from lsp file
  spacer;
  : text {
    key = "text1";
    label = "";//question$ from lsp file
    width = 35.0;
    alignment = centered;
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "yes";
      label = "&yes";
      is_default = true;
      width = 7.92;
      fixed_width = true;
    }
    : button {
      key = "no";
      label = "&no";
      is_cancel = true;
      width = 7.92;
      fixed_width = true;
    }
  }
}//myyesno
 
create a directory and copy the two files.
add to search paths the created directory.
upload the dialog.lsp file and enter command:(c:myyesno "my yes no" "do you like creating programs in autolisp?") I tried and it works.
 

Attachments

I tried it works, now I would like to edit the two files so as to use them, not as "myyesno" in a generic way but in a particular way, therefore providing in the launch, the text of the question.
the text of the question should be part of the files themselves, thus launching the command only with its name, as a lisp is normally launched.
Can you do that?
the question is "you really want to delete the file '", the name of the two files "eliminalib" and the name of the buttons "yes" and "no"
I tried to do it myself but with disappointing results.
Thank you.
 
by lisp just use it as a function:
(if (= (c:myyesno "elimina" "you really want to delete the file ?") "yes")
(instructions to delete files)
)
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top