Vismut65 Posted December 2, 2011 Posted December 2, 2011 Hi, I have a problem with action tile. I want to change contents in a popup_list when I push different radio buttons. I have write the code: (action_tile "str_l2" "(start_list \"mylist1\" 3) (mapcar 'add_list myList5) (end_list)" ) (action_tile "str_l3" "(start_list \"mylist1\" 3) (mapcar 'add_list myList6) (end_list)" ) But it doesnt work /Dan Quote
pBe Posted December 2, 2011 Posted December 2, 2011 Welcome to the forum Dan Radio button return value would be "1" or "0" (if (eq radiobuttonval "1") (start_list "mylist1")(mapcar 'add_list myList5)(end_list);<---- pointing to the same key but different lists (start_list "mylist1")(mapcar 'add_list myList6)(end_list);<----- ) Quote
Lee Mac Posted December 2, 2011 Posted December 2, 2011 Hi Dan, After a quick look at your code, it looks like it should work. I would suggest creating a subfunction to populate the DCL popup_list tiles: (defun FillPopupList ( key lst ) (start_list key) (foreach item lst (add_list item)) (end_list) ) (action_tile "radio_button_key1" "(FillPopupList \"popup_list_key\" YourList1)") (action_tile "radio_button_key2" "(FillPopupList \"popup_list_key\" YourList2)") Quote
Vismut65 Posted December 2, 2011 Author Posted December 2, 2011 Hi, Thank you for the answer, but I have 6 radio buttons. How to do with 6 buttons. I have an another problem also. I have 2 pop_ut lists. I want the second pop_up list to be grey_out. But when I have make a choose in the first pop_up list I want the second pop_up list be activated. Quote
Lee Mac Posted December 2, 2011 Posted December 2, 2011 Very quick example: DCL code (save as "test.dcl"): test : dialog { label = "Example"; spacer; : boxed_radio_row { label = "Select List"; : radio_button { key = "radio1"; label = "List 1"; } : radio_button { key = "radio2"; label = "List 2"; } } spacer; : popup_list { key = "popup"; } spacer; ok_only; } LISP code: (defun c:test ( / FillPopupList lst1 lst2 id ) (setq lst1 '("One" "Two" "Three" "Four") lst2 '("Red" "Yellow" "Green" "Blue") ) (defun FillPopupList ( key lst ) (start_list key) (foreach item lst (add_list item)) (end_list) ) (cond ( (<= (setq id (load_dialog "test.dcl")) 0) (princ "\ntest.dcl file not found.") ) ( (not (new_dialog "test" id)) (princ "\nDialog could not be loaded.") ) ( t (FillPopupList "popup" lst1) (set_tile "radio1" "1") (action_tile "radio1" "(FillPopupList \"popup\" lst1)") (action_tile "radio2" "(FillPopupList \"popup\" lst2)") (start_dialog) ) ) (if (< 0 id) (unload_dialog id)) (princ) ) Quote
Vismut65 Posted December 2, 2011 Author Posted December 2, 2011 Hi Lee Mac, That worked great. Thank you. I have one more issue. I have 2 pop-up lists The first(mylist20) is set to "true" and the second(mylist21) is "false"(greyout). That I want to do is when I have make my choose in the first pop_up I want the second to be activated ("true"). I filled in some in your defun FillPopupList but it doesnt work. Do you know how to do?. (defun FillPopupList ( key lst ) (start_list key) (foreach item lst (add_list item)) (end_list) "(mode_tile \"mylist21\" 0)" ) Quote
Lee Mac Posted December 2, 2011 Posted December 2, 2011 Perhaps this example will indicate how to enable / disable tiles within action_tile expressions: DCL code (save as "test.dcl"): test : dialog { label = "Example"; spacer; : boxed_radio_row { label = "Select List"; : radio_button { key = "radio1"; label = "List 1"; } : radio_button { key = "radio2"; label = "List 2"; } } spacer; : popup_list { key = "popup1"; } : popup_list { key = "popup2"; } spacer; ok_only; } LISP code: (defun c:test ( / FillPopupList lst1 lst2 id ) (setq lst1 '("One" "Two" "Three" "Four") lst2 '("Red" "Yellow" "Green" "Blue") ) (defun FillPopupList ( key lst ) (start_list key) (foreach item lst (add_list item)) (end_list) ) (cond ( (<= (setq id (load_dialog "test.dcl")) 0) (princ "\ntest.dcl file not found.") ) ( (not (new_dialog "test" id)) (princ "\nDialog could not be loaded.") ) ( t (FillPopupList "popup1" lst1) (FillPopupList "popup2" lst2) (set_tile "radio1" "1") (mode_tile "popup2" 1) (action_tile "radio1" "(mode_tile \"popup1\" 0) (mode_tile \"popup2\" 1)") (action_tile "radio2" "(mode_tile \"popup2\" 0) (mode_tile \"popup1\" 1)") (start_dialog) ) ) (if (< 0 id) (unload_dialog id)) (princ) ) Quote
pBe Posted December 2, 2011 Posted December 2, 2011 Very quick example:.... Quick mind, quick programming.... Quote
Lee Mac Posted December 2, 2011 Posted December 2, 2011 Quick mind, quick programming.... Thanks pBe Quote
Vismut65 Posted December 8, 2011 Author Posted December 8, 2011 Hello Lee Mac, Sorry for the late answer, have been on a business tripp. I have one more issue. I have 2 pop-up lists the first "Select el.motor" (mylist20) is set to "true" and the second "Select pump"(mylist21) is "false"(greyout). That I want to do is when I have make my choose in the first pop_up I want the second to be activated ("true"). Do you know how to do?. dimdialog5 : dialog { // Första label = "Dimention drawing"; : row { : boxed_radio_column { : row { // Row 1 : boxed_radio_column { // Boxed_radio_column 1 label = "Size Cabinet"; key = "size"; : radio_button { // defines the Lightweight radio button label = "&Small 2D"; key = "str_s2"; // value = "1"; } : radio_button { // defines the old-style polyline radio button label = "&Medium 2D"; key = "str_m2"; } : radio_button { // defines the old-style polyline radio button label = "&Large 2D"; key = "str_l2"; } : radio_button { // defines the old-style polyline radio button label = "&Small 3D"; key = "str_s3"; } : radio_button { // defines the old-style polyline radio button label = "&Medium 3D"; key = "str_m3"; } : radio_button { // defines the old-style polyline radio button label = "&Large 3D"; key = "str_l3"; } }// Boxed_radio_column 1 : boxed_radio_column { // Boxed_radio_column 2 : boxed_radio_row { label = "Parts"; key = "S2pop"; value = "0"; is_enabled = true; : boxed_radio_column { : popup_list { key = "mylist20"; label = "&Select el.motor"; fixed_width_font = true; width = 30; value = ""; is_enabled = true; } : popup_list { key = "mylist21"; label = "&Select pump"; fixed_width_font = true; width = 30; value = ""; is_enabled = false; } } : popup_list { key = "mylist7"; label = "&Select cooler"; fixed_width_font = true; width = 30; value = ""; is_enabled = true; } } : boxed_radio_row { key = "m2pop"; value = "0"; is_enabled = false; } } } : boxed_radio_row { : row { label = "Panels"; : boxed_radio_column { // Boxed_radio_column 1 label = "Panel"; // defines the radio button areas key = "panel"; : radio_button { // defines the ActiveX radio button label = "&Inga paneler"; key = "ej_pan"; } : radio_button { // defines the ActiveX radio button label = "Med paneler"; key = "med_pan"; value = "1"; } : radio_button { // defines the (entmake) radio button label = "Med paneler+ljudoption"; key = "med_ljudo"; } } : column { : radio_button { // defines the ActiveX radio button label = "&Singelpump"; key = "sp"; value = "1"; } : radio_button { // defines the ActiveX radio button label = "Tandempump"; key = "tp"; } } } : row { label = "Spider"; : column { // defines the radio button areas : radio_button { // defines the ActiveX radio button label = "&Ingen spider"; key = "i_spid"; value = "0"; } : radio_button { // defines the ActiveX radio button label = "&Placering höger sida"; key = "phs"; value = "1"; } : radio_button { // defines the ActiveX radio button label = "&Placering vänster sida"; key = "pvs"; } } : column { : radio_button { // defines the ActiveX radio button label = "&Panel utsida dörr"; value = "1"; key = "pud"; } : radio_button { // defines the ActiveX radio button label = "&Panel insida dörr"; key = "pid"; } } } : boxed_radio_row { label = "&Replenishment"; : popup_list { key = "rep"; label = "&Välj"; fixed_width_font = true; width = 30; value = ""; //is_enabled = false; } } } } } : boxed_row { : button { key = "accept"; label = " Okay "; is_default = true; } : button { key = "cancel"; label = " Cancel "; is_default = false; is_cancel = true; } } } //Sista /Dan Quote
Lee Mac Posted December 8, 2011 Posted December 8, 2011 You can include a mode_tile statement within the action_tile statement of the first popup_list. However, a popup_list will always have a selection (even before the user has chosen something an item will be shown), so the behaviour you are looking to achieve may not be intuitive for the user. Lee Quote
Vismut65 Posted December 9, 2011 Author Posted December 9, 2011 Tanks Lee for your anwer, I have one more issue. I want to have different contents in two popup_lists "mylist20" and "mylist21" depending of chooise "sp" or "tp". I have wrote a code see below but it doesnt work. Can you help me?. (action_tile "sp" (progn (action_tile "str_s2" "(FillPopupList1 \"mylist20\" mylist1)(FillPopupList2 \"mylist21\" mylist70)") (action_tile "str_m2" "(FillPopupList1 \"mylist20\" mylist2)(FillPopupList2 \"mylist21\" mylist71)") (action_tile "str_l2" "(FillPopupList1 \"mylist20\" mylist3)(FillPopupList2 \"mylist21\" mylist72)") (action_tile "str_s3" "(FillPopupList1 \"mylist20\" mylist4)(FillPopupList2 \"mylist21\" mylist73)") (action_tile "str_m3" "(FillPopupList1 \"mylist20\" mylist5)(FillPopupList2 \"mylist21\" mylist74)") (action_tile "str_l3" "(FillPopupList1 \"mylist20\" mylist6)(FillPopupList2 \"mylist21\" mylist75)") ) ) (action_tile "tp" (progn (action_tile "str_s2" "(FillPopupList1 \"mylist20\" mylist6)(FillPopupList2 \"mylist21\" mylist76)") (action_tile "str_m2" "(FillPopupList1 \"mylist20\" mylist7)(FillPopupList2 \"mylist21\" mylist77)") (action_tile "str_l2" "(FillPopupList1 \"mylist20\" mylist8)(FillPopupList2 \"mylist21\" mylist78)") (action_tile "str_s3" "(FillPopupList1 \"mylist20\" mylist9)(FillPopupList2 \"mylist21\" mylist79)") (action_tile "str_m3" "(FillPopupList1 \"mylist20\" mylist10)(FillPopupList2 \"mylist21\" mylist80)") (action_tile "str_l3" "(FillPopupList1 \"mylist20\" mylist11)(FillPopupList2 \"mylist21\" mylist81)") ) ) /Dan Quote
Lee Mac Posted December 9, 2011 Posted December 9, 2011 action_tile expressions should be strings, but you are nesting action_tile statements within action_tile statements... 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.