This lisp will operate two functions to give you another idea how to use the toggle.
TOGGLE2.DCL
Code:
MAIN : dialog {
label = "Toggle2";
: boxed_column {
label = "Snap Angle";
: toggle {
label = "On/Off";
key = "TOG2";
}
}
: boxed_column {
label = "Control Buttons";
: button {
label = "&Proceed";
key = "accept";
width = 18;
fixed_width = true;
alignment = right;
is_default = true;
}
: button {
label = "&Exit Program";
key = "cancel";
width = 18;
fixed_width = true;
alignment = right;
is_cancel = true;
}
}
}
TOGGLE2.LSP
Code:
(defun C:TOGGLE2 (/ TOG2$)
(or T:OG2$ (setq T:OG2$ "1"))
(setq DCL_ID (load_dialog "TOGGLE2.dcl"))
(if (not (new_dialog "MAIN" DCL_ID))
(cond
((<= (setq DCL_ID (load_dialog "TOGGLE2.dcl")) 0)(princ "\nDialog File not Found"))
((not (new_dialog "MAIN" DCL_ID))(princ "\nDialog Definition not Found"))
(t)))
(set_tile "TOG2" T:OG2$)
(action_tile "TOG2" "(setq T:OG2$ $value)")
(action_tile "accept" "(done_dialog)(setq button T)")
(action_tile "cancel" "(done_dialog)(setq button nil)")
(start_dialog)(unload_dialog DCL_ID)
(setq TOG2$ T:OG2$)
(if button
(cond
((= TOG2$ "1")(TOGON2))
((= TOG2$ "0")(TOGOFF2))
)
)
(princ))
(defun TOGON2 ()
(alert "Toggle is on!")
(princ))
(defun TOGOFF2 ()
(alert "Toggle is off!")
(princ))
Bookmarks