Jump to content

Recommended Posts

Posted

Hi,

 

I have problem to get a list to a popup list.

 

The code below is not the whole code just a part of it. It is only "Large 2D" that can be tested. But the problem is when I push the "Choise" button I get the error message:

 

Command:

****** CQi ERROR HANDLER ******

Error: bad argument type: listp "mylist77".

  1. Choise size "Large 2D"
  2. Choise someting in the popup list
  3. Press "Choise" button

 
dimdialog18 : dialog { // Första
label = "Dimention drawing";

: row {
: boxed_radio_column {
: row {  // Row 1
: boxed_radio_column { // Boxed_radio_column 1
 label = "Size Cabinet";
        key = "sizecab";
 : radio_button {          // defines the Lightweight radio button
  label = "&Small 2D";
  key = "str_s2";
  value="0";
  action="(if (= \"1\" $value)(progn "
          "(setq stor \"1\")"
          "(mode_tile \"but1\" 1)"
                               "(start_list \"mylist20\" 3)"                   
                               "(mapcar 'add_list mylist1)"
                               "(end_list)))"; 
         
                              }                          
 : radio_button {         // defines the old-style polyline radio button
  label = "&Medium 2D";
  key = "str_m2";
  value="0";   
  action="(if (= \"1\" $value)(progn "
          "(setq stor \"2\")"
         "(mode_tile \"but1\" 1)"
                              "(start_list \"mylist20\" 3)"                   
                              "(mapcar 'add_list mylist2)"
                              "(end_list)))";
                              }
         
 : radio_button {         // defines the old-style polyline radio button
  label = "&Large 2D";
  key = "str_l2";
         value="0";   
  action="(if (= \"1\" $value)(progn "
          "(setq stor \"3\")"
          "(setq sizes sizesl)"     
          "(mode_tile \"but1\" 1)"
                               "(start_list \"mylist20\" 3)"                   
                               "(mapcar 'add_list mylist3)"
                               "(end_list)))";                    
                }            
 : radio_button {         // defines the old-style polyline radio button
  label = "&Small 3D";
  key = "str_s3";
  value="0";   
  action="(if (= \"1\" $value)(progn "
          "(setq stor \"1\")"
          "(mode_tile \"but1\" 1)"
                               "(start_list \"mylist20\" 3)"                   
                               "(mapcar 'add_list mylist1)"
                               "(end_list)))";   
                }
                

 : radio_button {         // defines the old-style polyline radio button
  label = "&Medium 3D";
  key = "str_m3";
  value="0";   
  action="(if (= \"1\" $value)(progn "
          "(setq stor \"2\")"
          "(mode_tile \"but1\" 1)"
                               "(start_list \"mylist20\" 3)"                   
                               "(mapcar 'add_list mylist2)"
                               "(end_list)))";   
                }                 
 : radio_button {         // defines the old-style polyline radio button
  label = "&Large 3D";
  key = "str_l3";
  value="0";   
  action="(if (= \"1\" $value)(progn "
          "(setq stor \"3\")"
          "(mode_tile \"but1\" 1)"
                               "(start_list \"mylist20\" 3)"                   
                               "(mapcar 'add_list mylist3)"
                               "(end_list)))";   
                }                 

         
                                                  
             }// 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 motor";
               fixed_width_font = true;
               width = 30;
               value = "";
        is_enabled = true;
             }
                               
            : button {
               key = "but1";
               label = "Choise";
               is_default = false;
               is_enabled = false;                             
               value="0";   
 action="(if (= \"1\" $value)(progn "
                    "(start_list \"mylist21\" 3)"
                    "(mapcar 'add_list source)"
                    "(end_list)))";
                      }
                      
 : popup_list {
               key = "mylist21";
               label = "&Select pump";
               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;
             }
           } 
} //Last line

 

 

 
(defun C:DUE_DIM()
(setq myList1(list "Välj" "---ABB---" "22 kW" "30 kW" "37 kW" "45 kW" "55 kW" "45 kW" "--Siemens--"));; Small 
(setq myList2(list "Välj" "---ABB---" "75 kW" "90 kW" "110 kW" "132 kW" "160 kW" "200 kW" "--Siemens--"));;medium
(setq myList3(list "Välj" "---ABB---" "250 kW" "315 kW" "355 kW" "400 kW" "500 kW" "--Siemens--"));;Large 
(setq myList70(list  "1" "SP71" "SP125" "Sp180"));;small
(setq myList72(list  "3"  "SP125" "SP180" "SP250" "Sp500""SP125/125" "SP180/180" "SP250/125" "SP250/250" "SP355/250" "SP355/355" "SP500/250" "SP500/355"));;Medium tandem
(setq myList73(list  "---Fel val--"))  ;;Large singel
(setq myList74(list  "5" "Sp500" "Sp750" "SP180/180" "SP250/125" "SP355/250" "SP355/355" "SP500/250" "SP500/355" "SP500/500"));;Large 250 kW
(setq myList75(list  "6" "Sp500" "Sp750" "SP180/180" "SP250/125" "SP355/250" "SP355/355" "SP500/250" "SP500/355" "SP500/500"));;Large 315 kW
(setq myList76(list  "7" "Sp500" "Sp750" "SP250/250" "SP355/250" "SP355/355" "SP500/250" "SP500/355" "SP500/500"));;Large 355 kW
(setq myList77(list  "8" "Sp750" "SP355/250" "SP355/355" "SP500/250" "SP500/355" "SP500/500"));;Large 400 kW
(setq myList78(list  "9" "Sp750" "SP355/355" "SP500/250" "SP500/355" "SP500/500"));;Large 500 kW
 
 ;;;--- Load the dcl file
 (setq dcl_id (load_dialog "dimritn18.dcl"))
 ;;;--- Load the dialog definition if it is not already loaded
 (if (not (new_dialog "dimdialog18" dcl_id))
   (progn
    (alert "The SAMPLE4.DCL file could not be loaded!")
     (exit)
   )
 )
 ;;;--- If an action event occurs, do this function
 (action_tile "accept" "(setq ddiag 2)(saveVars)(done_dialog)")
 (action_tile "cancel" "(setq ddiag 1)(done_dialog)")

;; set up dummy values:
(setq s2s3val "1")
(setq m2m3val "2")
(setq l2l3val "3")  
;;(setq sizess "mylist70" )  
;;(setq sizesm '("mylist74" "mylist75" "mylist76" "mylist77" "mylist78"))  
(setq sizesl '("mylist74" "mylist75" "mylist76" "mylist77" "mylist78"))   
 
(action_tile "mylist20" 
"(setq mychoise (strcat $value stor))
(mode_tile \"mylist21\" 0)
(cond ((= stor l2l3val)(setq source (nth (atoi $value) sizes))))
(princ sizesl)
(princ source)
(mode_tile \"but1\" 0)
 ")
 
 ;;;--- Display the dialog box
 (start_dialog)
 ;;;--- Unload the dialog box
 (unload_dialog dcl_id)
 ;;;--- If the user pressed the Cancel button
 (if(= ddiag 1)
   (princ "\n Sample4 cancelled!")
 )

 ;;;--- If the user pressed the Okay button
 (if(= ddiag 2)
   (progn 
      (cond
       ((= myChoice "str_s2sp")
 (progn
 (princ "\n Using Radio_column data...You chose ")
 (princ "Stativ S2")
 (princ "\n Using Radio_column data...You chose ")
          (cond
            ((= sStr1 "1")(princ "S2Höjd 320 mm"))
   )
 )
        )

       ((= myChoice "str_m2sp")
        (progn
 (princ "\n Using Radio_column data...You chose ")
 (princ "Stativ M2")
 (princ "\n Using Radio_column data...You chose ")
          (cond
            ((= sStr2 "1")(princ "M2Höjd 320 mm"))
   )
 )
      );;
                    
)
    )
   )
 ;;;--- Suppress the last echo for a clean exit
 (princ)
)

 

/Dan

Posted

quick glance

 

"(mapcar 'add_list source)"

 

source variable value is a string and not a list

 

so

 

 
"(mapcar 'add_list [color=blue](eval (read source))[/color])"

Posted
Thank you pBe for your help. Now it works:)

 

You're welcome Vismut65

 

Cheers

:beer:

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...