List boxes

Discussion in 'AutoCAD' started by Chuck, Nov 30, 2004.

  1. Chuck

    Chuck Guest

    I have a dialog box "pageset.dcl" . It consists of a radio button row with
    two radio butons "in" and "mm"
    with two pull down lists "scales" and "pages" and a standard ok_cancel row.
    I would like to populate the "pages"
    list with the "sizelist" and the "scales" list with either the "scalelisti"
    or "scalelistm" depending on which radio button is selected.
    This is the code I was trying to use to achieve this. Can you tell me what's
    wrong with this? I can't get it to work.
    I've tried a number of things and this is my latest attempt.

    (defun C:newdwg () ;define function
    (setvar "cmdecho" 0)
    (setq siz "24x36") ;preset page size
    (setq scl "1=1'-0") ;preset scale
    (setq sizelist '("8.5x11" "11x17" "24x36" "30x42" "36x48")
    ;define list page sizes
    ) ;setq
    (setq scalelisti
    '("1/16=1'-0" "1/8=1'-0" "3/16=1'-0" "1/4=1'-0"
    "3/8=1'-0" "1/2=1'-0" "5/8=1'-0" "3/4=1'-0"
    "1=1'-0" "1-1/2=1'-0" "3=1'-0" "6=1'-0"
    "12=1'-0"
    ) ;define list imperial
    ) ;setq
    (setq scalelistm
    '("1=200" "1=100" "1=80" "1=50" "1=40" "1=25"
    "1=20" "1=12.5" "1=10" "1=8" "1=4" "1=2"
    "1=1"
    ) ;define list metric
    ) ;setq
    (setq dcl_id (load_dialog "pageset.dcl")) ;load dialog
    (if (not (new_dialog "pageset" dcl_id) ;test for dialog
    ) ;not
    (exit) ;exit if no dialog
    ) ;if
    (setq w (dimx_tile "im") ;get image tile width
    h (dimy_tile "im") ;get image tile height
    ) ;setq
    (start_image "im")
    (fill_image 0 0 (dimx_tile "im") (dimy_tile "im") 0)
    (slide_image 0 0 (dimx_tile "im") (dimy_tile "im") "chuck")
    (end_image)
    (action_tile "in" "(setq butti \"1\")")
    (action_tile "mm" "(setq buttm \"1\")")
    (cond
    ((= butti "1") (setq UNIT_LIST scalelisti))
    ((= buttm "1") (setq UNIT_LIST scalelistm))
    )
    (start_list "scales") ;start the list box
    (mapcar 'add_list UNIT_LIST) ;fill the list box
    (end_list) ;end list
    (start_list "pages") ;start the list box
    (mapcar 'add_list sizelist) ;fill the list box
    (end_list) ;end list
    (action_tile
    "cancel" ;if cancel button pressed
    "(done_dialog) (setq userclick nil)" ;close dialog, set flag
    ) ;action_tile
    (action_tile
    "accept" ;if O.K. pressed
    (strcat ;string 'em together
    "(progn
    (setq SIZ (atof (get_tile \"pages\")))(setq SCL (atof (get_tile
    \"scales\")))"
    ;get list selection
    " (done_dialog)(setq userclick T))" ;close dialog, set flag
    ) ;strcat
    ) ;action tile
    (start_dialog) ;start dialog
    (unload_dialog dcl_id) ;unload
    (if userclick ;check O.K. was selected
    (progn
    (setq SIZ (fix SIZ)) ;convert to integer
    (setq SIZ (nth SIZ sizelist)) ;get the size
    (setq SCL (fix SCL)) ;convert to integer
    (setq SCL (nth SCL UNIT_LIST)) ;get the size
    (settings)
    ) ;progn
    ) ;if userclick
    (princ)
    )
     
    Chuck, Nov 30, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.