DCL Error Check

Discussion in 'AutoCAD' started by Rad_Cadder, Nov 2, 2004.

  1. Rad_Cadder

    Rad_Cadder Guest

    I am new to writing dcl and want to set up error checking to force user to input all required data.
    I borrowed a portion of this code from a previous post and cannot make it work.
    Any help would be greatly appreciated.

    (defun OKCallBack ()
    (if ((= (get_tile "billto") nil)
    (alert "You must enter billing manager.")
    ;; Set the focus to the tile the user forgot
    (mode_tile "billto" 2)
    )
    (if (= (get_tile "proj_num") nil)
    (alert "You must enter project number.")
    ;; Set the focus to the tile the user forgot
    (mode_tile "proj_num" 2)
    )
    (if (= (get_tile "plotter") nil)
    (alert "You must select a plotter.")
    ;; Set the focus to the tile the user forgot
    (mode_tile "plotter" 2)
    )
    (if (= (get_tile "paper") nil)
    (alert "You must select paper size.")
    ;; Set the focus to the tile the user forgot
    (mode_tile "paper" 2)
    )
    (if (= (get_tile "copycnt") nil)
    (alert "You must enter number of copies.")
    ;; Set the focus to the tile the user forgot
    (mode_tile "copycnt" 2)
    )

    (T
    (done_dialog 1)
    )
    )
    )
     
    Rad_Cadder, Nov 2, 2004
    #1
  2. Define the 'errtile' in the dialog box.
    Call the 'errtile' from the lisp instead of the alert and disable the OK
    button.
    The error should display on the dialogue box and the OK is than greyed.
    Read the helpfiles on this.
    Otherwise you have to hide the dialogue box, throw up the alert, click ok
    there, call back the dialogue.
    Also covered in the help files.

    Jan
     
    Jan van de Poel, Nov 3, 2004
    #2
  3. Rad_Cadder

    BillZ Guest

    This should work fine if used with the "accept" button on an action tile.

    Make sure this is your only accept call.
    (action_tile "accept" "(OKCallBack)")

    That way, when okay is pressed, it will check each tile listed and do a done_dialog if all is well. Otherwise returns to the dialog.

    HTH

    Bill
     
    BillZ, Nov 3, 2004
    #3
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.