start_list locks up my system...

Discussion in 'AutoCAD' started by Sage Cowsert, Dec 20, 2004.

  1. Sage Cowsert

    Sage Cowsert Guest

    I have a two radio buttons that when pressed would/should change the
    contents of a popup_list but currently just locks up my system.

    The radio buttons look like this:

    (action_tile "ftg_totalbar_toggle" "(OCNUMTOGGLE)")
    (action_tile "ftg_oncenter_toggle" "(OCNUMTOGGLE)")

    Then:
    (defun OCNUMTOGGLE ()
    ;;; (setq REBAR_SIZES_OPTION '("2" "3" "4" "5" "6" "7" "8" "9" "10" "11"
    "14" "18"))
    ;;; (setq REBAR_SPACING_OPTION '("3\"" "4\"" "5\"" "6\"" "7\"" "8\"" "9\""
    "10\"" "11\"" "12\"" "14\"" "18\""))
    (if (= "1" (get_tile "ftg_totalbar_toggle"))
    (progn
    (start_list "stem_rebar_numb")
    (mapcar 'add_list FTG_NUMBER_OPTION)
    (end_list)
    )
    (progn
    (start_list "stem_rebar_numb")
    (mapcar 'add_list REBAR_SPACING_OPTION)
    (end_list)
    )
    )
    )

    Any thoughts?
     
    Sage Cowsert, Dec 20, 2004
    #1
  2. Sage Cowsert

    BillZ Guest

    Seems to work here.

    I don't see FTG_NUMBER_OPTION list anywhere so I haven't tested that one.

    Bill
     
    BillZ, Dec 20, 2004
    #2
  3. Sage Cowsert

    Sage Cowsert Guest

    Missed that one. Here it is. Thanks. :)

    (setq FTG_NUMBER_OPTION '("None" "2" "3" "4" "5" "6" "7" "8" "9" "10"))
     
    Sage Cowsert, Dec 20, 2004
    #3
  4. Sage Cowsert

    Rudy Tovar Guest

    My 2 cents, but You should have to rebuild the list every time you pick the
    button...

    You should create a statup function to hold the listings, and organized it
    just a bit more...follow the example...

    (defun setup (/)
    ;listing1
    ;listing2
    ;etc.
    (princ)
    )

    (setup)
    (action_tile "radio1" "(setq con 1)(toggle_list)")
    (action_tile "radio2" "(setq con 2)(toggle_list)")

    (defun toggle_list (/)

    (cond
    ((= con 1)
    (progn
    (start_list "list1" 3)
    (mapcar 'add_list <;listing1>)
    (end_list)
    ))
    ((= con 2)
    (progn
    (start_list "list1" 3)
    (mapcar 'add_list <;listing2>)
    (end_list)
    ))
    )

    ;Nothing to fancy, just the structure...
    --
    MASi
    Copyright 2004 by Cadentity
    www.Cadentity.com
    Autodesk
    Authorized Developer
     
    Rudy Tovar, Dec 20, 2004
    #4
  5. Sage Cowsert

    Rudy Tovar Guest

    My correction "...shouldn't rebuild the list each time you pick the
    button..."


     
    Rudy Tovar, Dec 21, 2004
    #5
  6. Sage Cowsert

    BillZ Guest

    Sage Cowsert,

    I am thinking that you want all 3 values returned to calculate your final results, correct?

    It would seem a lot simpler if you would have 3 popup lists and have the user make a choice from each one of them.

    As Rudy T. already stated, there's no need to set the value of the list variables more than once. They can be set at the start of the dialog.

    See example below:

    Code:
                  ;BILL ZONDLO 12/21/04
    ;to get value of popup picks.
    ;-----;
    (defun set_variable ()
    (setq ListVal1 (get_tile "stem_rebar_numb1")
    ListVal2 (get_tile "stem_rebar_numb2")
    ListVal3 (get_tile "stem_rebar_numb3")
    ListVal1 (nth (atoi ListVal1) FTG_NUMBER_OPTION)
    ListVal2 (nth (atoi ListVal2) REBAR_SPACING_OPTION)
    ListVal3 (nth (atoi ListVal3) REBAR_SIZES_OPTION)
    )
    
    (done_dialog 1)
    )
    ;-----;
    (defun c:TestRadio (/ an dcl_id ListVal1 ListVal2 ListVal3
    REBAR_SIZES_OPTION REBAR_SPACING_OPTION FTG_NUMBER_OPTION)
    ;-----;
    (setq dcl_id (load_dialog "g:/lsptemp/testradio.dcl"))
    (if (not (new_dialog "testradio" dcl_id ""))
    (exit)
    (progn
    (setq REBAR_SIZES_OPTION
    '("2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "14" "18")
    )
    (setq REBAR_SPACING_OPTION
    '("3\"" "4\"" "5\"" "6\"" "7\"" "8\"" "9\"" "10\"" "11\"" "12\"" "14\"" "18\"")
    )
    (setq FTG_NUMBER_OPTION
    '("None" "2" "3" "4" "5" "6" "7" "8" "9" "10")
    )
    (start_list "stem_rebar_numb1")
    (mapcar 'add_list FTG_NUMBER_OPTION)
    (end_list)
    
    (start_list "stem_rebar_numb2")
    (mapcar 'add_list REBAR_SPACING_OPTION)
    (end_list)
    
    (start_list "stem_rebar_numb3")
    (mapcar 'add_list REBAR_SIZES_OPTION)
    (end_list)
    
    (action_tile "accept" "(set_variable)")
    (action_tile "cancel" "(done_dialog 0)")
    (setq an (start_dialog))
    (unload_dialog dcl_id)
    )                                                    ;end progn
    )                                                        ;end if
    ;---;
    (if (= an 1)
    (alert (strcat " Test returns <  " ListVal1 "  " ListVal2 "  " ListVal3  "  > from Dialog."))
    )
    ;---;
    (princ)
    )
    Heres the dialog for this test.

    Code:
    //  Bill Zondlo  12/21/04
    //  Dialoge Box for popup test
    //
    //
    dcl_settings : default_dcl_settings
    { audit_level = 3       ;}
    testradio : dialog {
    label = "	Test Radio Value"  ;
    
    :text {
    label =   ""        ;
    key   =   "info"    ;
    }
    :row  {
    fixed_width  =  true   ;
    :popup_list {
    label = "Pick1: "  ;
    key   =  "stem_rebar_numb1"   ;
    width = 15 ;
    fixed_width  =  true   ;
    alignment    =   centered   ;
    }
    :spacer_1{}
    :popup_list {
    label = "Pick2: "  ;
    key   =  "stem_rebar_numb2"   ;
    width = 15 ;
    fixed_width  =  true   ;
    alignment    =   centered   ;
    }
    :spacer_1{}
    :popup_list {
    label = "Pick3: "  ;
    key   =  "stem_rebar_numb3"   ;
    width = 15 ;
    fixed_width  =  true   ;
    alignment    =   centered   ;
    }
    }
    :spacer {height = 2 ; }
    :boxed_row  {
    
    :text_part  {
    label        = "   Press OK:" ;
    }
    
    ok_cancel                     ;
    alignment  =  centered  ;
    fixed_width   =  true         ;
    }
    :spacer {height = 1 ; }
    
    }
    If this is not what you want, let me know.

    Bill
     
    BillZ, Dec 21, 2004
    #6
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.