当然我不介意,仔细看看,如果你对代码有任何疑问或问题,请告诉我
- (defun c:Test (/ f dlg lst id)
- ;;; Tharwat 08.01.2014 ;;
- (cond
- ((not
- (and
- (setq dlg (vl-filename-mktemp nil nil ".dcl"))
- (setq f (open dlg "w"))
- (write-line
- "options : dialog {label = "Sample";
- spacer_1 ;
- : popup_list { label = "Select Box"; key = [color=red]"bx"[/color];}
- : boxed_radio_row {
- : radio_button { label = "Left"; key = [color=mediumturquoise]"l"[/color];}
- : radio_button { label = "Right"; key = [color=magenta]"r"[/color];}}
- : button { label = "Okay"; key = "oki"; is_default = true;}
- : button { label = "Exit"; key = "esc"; is_cancel = true; }} "
- f
- )
- (not (close f))
- )
- )
- (alert "Can't load the temporary file <!>")
- )
- ((or (not dlg)
- (not (> (setq id (load_dialog dlg)) 0))
- (not (new_dialog
- "options"
- id
- )
- )
- )
- (princ "\n Can not load Dialog !")
- )
- (t
- (set_tile "l" "1")
- (setq lst '("BOX1" "BOX2" "BOX3" "BOX4" "BOX5"))
- (start_list "bx")
- (mapcar 'add_list lst)
- (end_list)
- [color=blue] (action_tile [color=red]"bx"[/color] "(if (eq (rem (atoi (get_tile [color=mediumturquoise]"l"[/color])) 2) 1) (set_tile [color=magenta]"r"[/color] "1")(set_tile "l" "1"))")[/color]
- (action_tile "oki" "(done_dialog)")
- (action_tile "esc" "(done_dialog)")
- (start_dialog)
- (unload_dialog id)
- (vl-file-delete dlg)
- )
- )
- (princ)
- )
|