Welcome to the Southern African Autolisp Website.
You are Visitor Number since 11th June 1999.
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)
All Tutorials and Code are provided "as-is" for purposes of instruction and
utility and may be used by anyone for any purpose entirely at their own risk.
Please respect the intellectual rights of others.
All material provided here is unsupported and without warranty of any kind.
No responsibility will be taken for any direct or indirect consequences
resulting from or associated with the use of these Tutorials or Code.
Copyright © 1999 by
Kenny Ramage
All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage.
|