toggle.
Syntax:
: toggle {
action alignment fixed_height fixed_width
height is_enabled is_tab_stop key label
mnemonic value width
}
DCL Coding:
lisp48l : dialog { //dialog name
label = "toggle" ; //give it a label
:toggle { //define toggle
key = "tog1"; //give it a name
label = "Ortho On/Off"; //give it a label
} //end toggle
:toggle { //define toggle
key = "tog2"; //give it a name
label = "Snap On/Off"; //give it a label
} //end definition
ok_cancel ; //predefined OK/Cancel button
} //end dialog
AutoLisp Coding:
(defun C:lisp48l ()
;define function
(setq dcl_id (load_dialog "lisp48l.dcl"))
;load dialog
(if (not (new_dialog "lisp48l" dcl_id)
;test for dialog
);not
(exit)
;exit if no dialog
);if
(setq orth (itoa (getvar "orthomode")))
;get orthomode value
(set_tile "tog1" orth)
;switch toggle on or off
(setq sna (itoa (getvar "snapmode")))
;get snap value
(set_tile "tog2" sna)
;switch toggle on or off
(action_tile "tog1" "(setq orth $value)")
;get ortho toggle value
(action_tile "tog2" "(setq sna $value)")
;get snap toggle value
(action_tile
"accept"
;if O.K. pressed
(strcat
;string 'em together
"(progn
(setvar \"orthomode\" (atoi orth))"
;ortho on/off
"(setvar \"snapmode\" (atoi sna))"
;snap on/off
"(done_dialog)(setq userclick T))"
;close dialog, set flag
);strcat
);action tile
(action_tile
"cancel"
;if cancel button pressed
"(done_dialog) (setq userclick nil)"
;close dialog
);action_tile
(start_dialog)
;start dialog
(unload_dialog dcl_id)
;unload
(if userclick
;if OK selected
(progn
;do the following
(if (= orth 1)
(alert "Ortho is ON")
(alert "Ortho is OFF")
);if
(if (= sna 1)
(alert "Snap is ON")
(alert "Snap is OFF")
);if
);progn
);if userclick
(princ)
);defun
(princ)
|