Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

dialog box

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
marlance
481 Views, 2 Replies

dialog box

How can I create a dialog box with this simple code?

(defun c:test ()
(setq |CMDECHO| (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setvar "osmode" 512)
(setq a (getreal"\nEnter A: "))
(setq b (getreal"\nEnter B: "))
(setq c (+ a b))
(command"text" "0,0" 2.5 "0" c "")
(princ)
)







 

2 REPLIES 2
Message 2 of 3
smaher12
in reply to: marlance

The lsp.....

 

(defun c:test ()
  (setq oldecho (getvar 'cmdecho))
  (setvar 'osmode 512)

  (initiate)
  (setq c (+ a b))
  (command "_.text" "0,0" 2.5 0 (rtos c 2 0))
 (princ)
)

(defun initiate ()
  (setq dcl_id (load_dialog "test.dcl"))
  (if (not (new_dialog "test" dcl_id))
    (exit)
  )

  (action_tile "aa" "(setq a (distof $value))")
  (action_tile "bb" "(setq b (distof $value))")
  (action_tile "accept" "(done_dialog)")
  (action_tile "cancel" "(exit)")
   (start_dialog)
    (unload_dialog dcl_id)
     (princ)
)

 

The dialog box....

 

test : dialog {
   label = "Sandbox" ;

spacer ;
:row {
 : boxed_column {
  label = "Specifications ";
           
 : edit_box {
   label = "A:";
   key = "aa";
   edit_width = 5;
   allow_accept = false;
 }
 : edit_box {
   label = "B:";
   key = "bb";
   edit_width = 5;
   allow_accept = false;
 }   
 } // end boxed_radio_column

} // end row

  ok_cancel;
  }

 

 

Message 3 of 3
hmsilva
in reply to: marlance

Hi rulep21.

 

Just as a different approach, rebuilt from an old demo, that tests the entered value if valid one, prior to submitting to the addition.
I did't include in the code the getvar/setvar and I entmake the Text.

 

Hope that helps!
Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta