mhy3sx Posted July 7 Posted July 7 Hi this is a part of a big lisp code. I use a dcl file to manage 3 options. I try to update the code and 2 more options .I f the five option are in the same boxed_radio_column all work fine, but I want to divide to two boxed_radio_column. In the code bellow I use the same { key=\042key\042 I know that there is the error , but i try to change it but option work in the code. Can anyone help me to fix the code? (defun *error* (msg) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) ) (princ (strcat "\nError: " msg)) ) (princ) ) (setvar "OSMODE" 13) (cond ((not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ((progn (foreach str '( "ed : edit_box { alignment = left; width = 25; edit_width = 10; fixed_width = true;}" "" "dgmsynt : dialog { spacer; key = \"dcl\";" " : boxed_radio_column { key=\042key\042; label = \"TITLE1\"; height = 1.0;" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button01\"; label = \"1. OPTION1\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button02\"; label = \"2. OPTION2\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button03\"; label = \"3. OPTION3\";" " }" " }" " : boxed_radio_column { key=\042key\042; label = \"TITLE2\"; height = 1.0;" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button01\"; label = \"1. OPTION4\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button02\"; label = \"2. OPTION5\";" " }" " }" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ((not (new_dialog "dgmsynt" dch)) (princ "\nUnable to display 'dgmsynt' dialog.") ) (t (set_tile "dcl" "LEABEL") (action_tile "key" "(setq sng $value)") (action_tile "OK" "(done_dialog 1)") (start_dialog) ;; Main ----- (cond ((eq sng "radio_button01") (_Option1)) ((eq sng "radio_button02") (_Option2)) ((eq sng "radio_button03") (_Option3)) ((eq sng "radio_button04") (_Option4)) ((eq sng "radio_button05") (_Option5)) ) ) ) (*error* nil) Thanks Quote
rlx Posted July 7 Posted July 7 (edited) a radio row or column doesn't have a key (nor does it need a height). Also a new radio column doesn't mean you can start recycling key names. I understand you want to save the planet by recycling but my advise would be to recycle your mother-in-law or something / somebody (foreach str '( "ed : edit_box { alignment = left; width = 25; edit_width = 10; fixed_width = true;}" "" "dgmsynt : dialog { spacer; key = \"dcl\";" " : boxed_radio_column {label = \"TITLE1\";" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button01\"; label = \"1. OPTION1\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button02\"; label = \"2. OPTION2\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button03\"; label = \"3. OPTION3\";" " }" " }" " : boxed_radio_column {label = \"TITLE2\";" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button04\"; label = \"1. OPTION4\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button05\"; label = \"2. OPTION5\";" " }" " }" " ok_only;" "}" ) (write-line str des) ) Edited July 7 by rlx 1 Quote
mhy3sx Posted July 7 Author Posted July 7 Hi rlx. I already did this change but every change I do the option1,2,3,4,5 dont work. When I put all in one column then everything work fine. Can any one tell me why? (cond ((eq sng "radio_button01") (_Option1)) ((eq sng "radio_button02") (_Option2)) ((eq sng "radio_button03") (_Option3)) ((eq sng "radio_button04") (_Option4)) ((eq sng "radio_button05") (_Option5)) ) Thanks Quote
rlx Posted July 7 Posted July 7 (defun c:t1 ( / dch dcl msg des drv) (defun *error* (msg) (if (and (= 'int (type dch)) (< 0 dch))(unload_dialog dch)) (if (= 'file (type des))(close des)) (if (and (= 'str (type dcl)) (findfile dcl))(vl-file-delete dcl)) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg))) (princ) ) (setvar "OSMODE" 13) (if (not (and (setq dcl (vl-filename-mktemp nil nil ".dcl"))(setq des (open dcl "w")))) (princ "\nUnable to open DCL for writing.") (foreach str '("ed : edit_box { alignment = left; width = 25; edit_width = 10; fixed_width = true;}" "" "dgmsynt : dialog { spacer; key = \"dcl\";" " : boxed_radio_column {label = \"TITLE1\";" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button01\"; label = \"1. OPTION1\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button02\"; label = \"2. OPTION2\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button03\"; label = \"3. OPTION3\";" " }" " }" " : boxed_radio_column {label = \"TITLE2\";" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button04\"; label = \"1. OPTION4\";" " }" " : radio_button { height = 1.0; width = 25; is_tab_stop = true;" " key = \"radio_button05\"; label = \"2. OPTION5\";" " }" " }" " ok_cancel;" "}" ) (write-line str des) ) ;;; end foreach ) ;;; end if (if des (progn (close des)(gc))) (if (and (setq dch (load_dialog dcl)) (new_dialog "dgmsynt" dch)) (progn (action_tile "radio_button01" "(setq sng 1)") (action_tile "radio_button02" "(setq sng 2)") (action_tile "radio_button03" "(setq sng 3)") (action_tile "radio_button04" "(setq sng 4)") (action_tile "radio_button05" "(setq sng 5)") (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") ;;; dialog return value (setq drv (start_dialog)) ;;; once loaded , get rid of temp dcl file (if (and dcl (findfile dcl))(vl-file-delete (findfile dcl))) (cond ((= drv 0)) ((= drv 1) (cond ((= sng 1)(_Option1)) ((= sng 2)(_Option2)) ((= sng 3)(_Option3)) ((= sng 4)(_Option4)) ((= sng 5)(_Option5)) ) ) ) ) ) (princ) ) Quote
BIGAL Posted July 8 Posted July 8 If the idea is 2 radio button answers need 2nd button to be say (action_tile "radio_button04" "(setq sng2 4)") as picking 1st button in boxed will be overwritten when selecting second button. This is my attempt at 2 radio button columns. Returns ah:col1 & ah:col2 etc indicating which button is selected. It is a library function use in any code, rather than hard code a lisp. Multi radio buttons 2col.lsp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.