dcl help needed...

Discussion in 'AutoCAD' started by aaron weissner, May 12, 2004.

  1. i am trying to set some variables using dcl but i keep getting nil... what
    i have is radio buttons with the defualt value set to 1 in the dcl file...
    if i add something like (action_tile "but" "(setq but $value)") to the lisp
    file... if i just hit okay to accept the defaults i get but = nil... if i
    change the radio button it works fine... and even if i change it and change
    it back to what is was it works fine... just not when i want to use the
    default... what am i doing wrong... i only have defaults set on a few
    radio buttons... most of the other info is all user input...
     
    aaron weissner, May 12, 2004
    #1
  2. aaron weissner

    BillZ Guest

    Action_tile only works with user interaction. So you will need to somehow set an initial value to your variable.
    There are 2 ways (maybe more) to do this.
    Either use (setq var with a value or (get_tile "but")), with "but" being the key to the radio_row/column or the button. Do this right before the action tiles,
    Or set the variable when the "accept" button is pressed.
    I do it like this:
    (action_tile "accept" "(set_val)")
    Then define a subr at the top of the same lisp file:
    (defun set_val ()
    (setq var1 (get_tile "thisradiocolumn") ;cutter size.
    var2 (get_tile "thisbutton")
    var3 (get_tile "otherbuttonorradiocolumn")
    )
    (done_dialog 1
    )

    The latter way insures that you have all the values you need to run your program.


    Bill
     
    BillZ, May 13, 2004
    #2
  3. thank you...


    set an initial value to your variable.
    the key to the radio_row/column or the button. Do this right before the
    action tiles,
     
    aaron weissner, May 13, 2004
    #3
  4. aaron weissner

    BillZ Guest

    Just a side note:

    Depending on what your needs are:
    I would recommend using the radio_row or column to get your value. i.e.
    (setq var1 (get_tile "radiorow"))
    or:
    (action_tile "radiorow" ("(setq var1 $value)")

    This is preferable to having an action_tile for each button.
    It will return the key of whatever button was pressed.
    The new help files don't seem to impress this.

    Here is a sample dialog to demonstrate what I'm saying:

    ;BILL ZONDLO 05/13/04
    ;
    ;Test
    ;
    ;-----;
    (defun c:test_radio ()
    ;-----;
    (setq dcl_id (load_dialog "g:/lsptemp/test_radio.dcl"))
    (if (not (new_dialog "test_radio" dcl_id "")) ;call dialog
    (exit)
    (progn
    (action_tile "rad_row" "(set_tile \"info\" $value)") ;
    (action_tile "accept" "(done_dialog 1)")
    (action_tile "cancel" "(done_dialog 0)") ;cancel
    (setq an (start_dialog))
    (unload_dialog dcl_id)
    ) ;end progn
    ) ;end if
    ;---;
    (princ)
    )

    And in the DCL File:

    // Bill Zondlo 05/11/04
    // Dialoge Box for test
    //
    //
    dcl_settings : default_dcl_settings
    { audit_level = 3 ;}
    test_radio : dialog {
    label = " Test Radio Value" ;
    :text {
    label = "" ;
    key = "info" ;
    }
    :boxed_radio_row {
    alignment = centered ;
    label = "Select Button:" ;
    key = "rad_row" ;
    :radio_button {
    label = "Button_1:" ;
    key = "But_1" ;
    value = "1" ;
    }
    :radio_button {
    label = "Button_2:" ;
    key = "But_2" ;
    value = "0" ;
    }
    :radio_button {
    label = "Button_3:" ;
    key = "But_3" ;
    value = "0" ;
    }
    :spacer {width = 3;}

    }
    :boxed_row {
    :text_part {
    label = " Press OK to test:" ;
    }

    ok_cancel ;
    alignment = centered ;
    fixed_width = true ;
    }

    }


    Bill
     
    BillZ, May 13, 2004
    #4
  5. aaron weissner

    BillZ Guest

    You're Welcome.


    Bill
     
    BillZ, May 13, 2004
    #5
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.