Author Topic: AutoCad Message : List Operation not supported : 4  (Read 2405 times)

0 Members and 1 Guest are viewing this topic.

sadhu

  • Guest
AutoCad Message : List Operation not supported : 4
« on: March 14, 2011, 09:44:21 AM »
When I run the code below I get the following error :
"AutoCad Message : List Operation not supported : 4"

The code is an example of how to use drop-down-list taken totally from http://www.jefferypsanders.com/autolisp_DCL_Part4.html
What is wrong here ?



Code: [Select]
(defun saveVars()

  ;;;--- Get the selected item from the first list
  (setq sStr1(get_tile "mylist1"))

  ;;;--- Make sure something was selected...
  (if(= sStr1 "")
    (setq myItem1 "Nothing")
    (setq myItem1 (nth (atoi sStr1) myList1))
  )

  ;;;--- Get the selected item from the second list
  (setq sStr2(get_tile "mylist2"))

  ;;;--- Make sure something was selected...
  (if(= sStr2 "")
    (setq myItem2 "Nothing")
    (setq myItem2 (nth (atoi sStr2) myList2))
  )
)

(defun C:SAMPLE4()

  (setq myList1(list "Electrical" "Structural" "Plumbing" "Foundation"))
    (setq myList2(list "Plastic" "Steel" "Aluminum" "Concrete"))

  ;;;--- Load the dcl file
  (setq dcl_id (load_dialog "SAMPLE4.dcl"))

  ;;;--- Load the dialog definition if it is not already loaded
  (if (not (new_dialog "SAMPLE4" dcl_id))
    (progn
     (alert "The SAMPLE4.DCL file could not be loaded!")
      (exit)
    )
  )

  (start_list "mylist1" 4)
  (mapcar 'add_list myList1)
  (end_list)

  (start_list "mylist2" 4)
  (mapcar 'add_list myList2)
  (end_list)

  ;;;--- 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)")

  ;;;--- 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

      ;;;--- Inform the user of his selection from the first list
      (princ (strcat "\n You chose " myItem1 " from the first popup list box."))

      ;;;--- Inform the user of his selections from the second list
      (princ (strcat "\n You chose " myItem2 " from the second popup list box."))

    )
  )


  ;;;--- Suppress the last echo for a clean exit
  (princ)


DCL file

Code: [Select]
SAMPLE4 : dialog {
          label = "Sample Dialog Box Routine - Part 4";
          : column {
            : boxed_row {
              : popup_list {
                key = "mylist1";
                label = "Select Item";
                fixed_width_font = true;
                width = 30;
                value = "";
              }
              : popup_list {
                key = "mylist2";
                label = "Select Item";
                fixed_width_font = true;
                width = 30;
                value = "";
              }
            }
            : boxed_row {
              : button {
                key = "accept";
                label = " Okay ";
                is_default = true;
              }
              : button {
                key = "cancel";
                label = " Cancel ";
                is_default = false;
                is_cancel = true;
              }
            }
          }

}


Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: AutoCad Message : List Operation not supported : 4
« Reply #1 on: March 14, 2011, 09:55:25 AM »
Hello.

Just remove number 4 which is beside the name of your list of strings.

Code: [Select]
  (start_list "mylist1" [color=red]4[/color])
  (start_list "mylist2" [color=red]4[/color])

Should be  :-)

Code: [Select]
(start_list "mylist1" )
 (start_list "mylist2" )

sadhu

  • Guest
Re: AutoCad Message : List Operation not supported : 4
« Reply #2 on: March 14, 2011, 10:02:58 AM »
Thank you Tharwat. It was just that. I wonder what that "4" is used for. It can't be an error.

 :-)

 

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: AutoCad Message : List Operation not supported : 4
« Reply #3 on: March 14, 2011, 10:35:08 AM »
From the HELP
Quote
Starts the processing of a list in the list box or in the pop-up list dialog box tile

(start_list key [operation [index]])
Subsequent calls to add_list affect the list started by start_list until the application calls end_list.

Arguments

key

A string that specifies the dialog box tile. The key argument is case-sensitive.

operation

An integer indicating the type of list operation to perform. You can specify one of the following:

1 Change selected list contents
2 Append new list entry
3 Delete old list and create new list (the default)

index

A number indicating the list item to change by the subsequent add_list call. The first item in the list is index 0. If not specified, index defaults to 0.
The index argument is ignored if start_list is not performing a change operation.

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

sadhu

  • Guest
Re: AutoCad Message : List Operation not supported : 4
« Reply #4 on: March 14, 2011, 11:20:38 AM »
I understand that the option "4" is not even contemplated.

Who will tell Jeffery ?   :?