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) )
Solved! Go to Solution.
Solved by smaher12. Go to Solution.
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;
}
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
Can't find what you're looking for? Ask the community or share your knowledge.