Author Topic: (DCL) How do you set a value in a popup_list?  (Read 9335 times)

0 Members and 1 Guest are viewing this topic.


  • Custom Title
  • Seagull
  • Posts: 28683
(DCL) How do you set a value in a popup_list?
« Reply #15 on: November 19, 2003, 03:35:00 PM »
Thank you gentlemen, it's starting to make sense now.  (serving the CAD community since 2003)


  • Guest
(DCL) How do you set a value in a popup_list?
« Reply #16 on: November 19, 2003, 03:42:42 PM »
You're welcome.

Wow, it may work for very small dialogs to put stuff into the OK button, but I think you'll get in trouble with more values.

For example, below is a loop of a quite large dialog. It doesn't matter what it does but outside this simple "engine" there is some 650 lines of utility functions that are called by the tiles (which keeps the ACTION_TILE calls very easy to write and maintain). The OK button does NOTHING except return a simple integer of 1.
If 1 then process the stuff, otherwise do nothing. If I had to construct an action_tile of all that I would go loco!

Code: [Select]
(while (>= action 2)
  (if (not (new_dialog "layercomp" dcl_id))
  (mapcar 'set_tile
          '("pos1" "pos2-4" "pos5" "pos6" "pos7")
          (list pos1 pos2-4 pos5 pos6 pos7)
  (set_tile "special" "0")              ; get from registry
  (start_list "ansvar")
  (mapcar 'add_list (mapcar 'cadr ansvarList))
  (set_tile "ansvar" currAnsvar)
  ;;change to registry
  (start_list "sfbmain")
  (mapcar 'add_list sfbmainOutput)
  (start_list "info_6")
  (mapcar 'add_list info6Output)
  (start_list "info_7")
  (mapcar 'add_list info7Output)
  (start_list "ltypes")
  (mapcar 'add_list ltypeList)
  (start_list "lweight")
  (mapcar 'add_list lwOutput)
  (set_tile "plotoff" currPlot)
  (updateCode5 currAnsvar)
  (updLayer t)
  (action_tile "special" "(checkSfBGroup)")
  (action_tile "pos8" "(setPos8 $value)")
  (action_tile "ansvar" "(updateCode5 (setq currAnsvar $value))")
  (action_tile "sfbmain" "(updateSfBGroups (setq currSfBMain $value))")
  (action_tile "sfbgroup" "(updateSfBPos (setq currSfBGroup $value))")
  (action_tile "code_5" "(setCode5 (setq currCode5 $value))")
    "(setInfo (setq currInfo6 $value) infolist_6 \"info6txt\" $key)"
    "(setInfo (setq currInfo7 $value) infolist_7 \"info7txt\" $key)"
  (action_tile "lweight" "(setq currLweight (nth (atoi $value) lwList))")
  (action_tile "currlayer" "(setCurrentLayer $value)")
  (action_tile "ltload" "(progn (ddloadLtype dcl_id)(updateLtypes))")
  (action_tile "ltypes" "(setq currLtype $value)")
  (action_tile "plotoff" "(setq currPlot $value)")
                                        ;(action_tile "ltypes" "(setLtypes (setq currLtype $value))")
  (action_tile "lcolor" "(setq currColor (getAcadColor currColor))")
  (action_tile "l_make" "(addlayer)")

  (setq action (start_dialog))
  (cond ((= action 1)
         (foreach n '(currAnsvar)
           (if (not (eval n))
             (set n "0")))
         (updLayer nil)
         ;; TODO 240903: do loading of lagStradaMainDlg in the start of function
         ;; and alert if not found!!! Delete this test then
         (cond ((not (member (type (eval makeLayer)) '(SUBR USUBR)))
                (cond ((load "lagStradaMainDlg" nil)
                       (foreach n finalrecords
                         (makeLayer (mapcar 'cdr n))
                (foreach n finalrecords
                  (makeLayer (mapcar 'cdr n) nil)
         (princ "Lagnavn: ")
         (princ currLayer)
         (mapcar 'princ
                 (list "\nL: " currLayer "\nLt: " currLtype "\nCol: " currColor "\nLw: " currLweight
                       "\ncurrPlot: " currPlot
         (princ currLyrInfo)