Dialog Box crawling

Discussion in 'AutoCAD' started by Fatfreek, Sep 22, 2004.

  1. Fatfreek

    Fatfreek Guest

    I am extremely inept at dialog box programming but have struggled this one
    to the point where it works. (BillZ helped with streamlining its format,
    thank you). However, I am at a loss as to trapping input errors as the
    operator leaves one field and before he enters the next field. Instead, I
    have 13 fields and the operator may hit the final okay before he learns that
    field 1 has an error. Better than nothing -- but I'd rather give more
    instant feedback.
    To get some idea of input editing I loaded the Garden Path routine (a VLX
    that I couldn't read if I wished) and ran it. I learned it has no input
    checking. In the field Radius of Tiles I entered abc (which of course is
    wrong not being a number value). Then I advance to the next field Spacing
    Between Tiles, did the same bad thing, and finally clicked OKAY. This error
    took me into my Vlide with no indication of what was wrong with what I did.
    My snippet for one of my fields, Text Height, follows, it works, but like
    I've said, it's after all the fields are filled. If push comes to shove,
    I'll proceed this way but I'd rather have more instant feedback. Len Miller

    (setq FixedFlag 0)
    (while (= FixedFlag 0)
    (if (eq (type (distof (get_tile "TextHt_GL"))) 'REAL)
    (progn
    (setq TextHt_GL (atof (get_tile "TextHt_GL")))
    (setq FixedFlag 1)
    )
    (alert "The Text Height field must be a REAL value.")
    )
    )
     
    Fatfreek, Sep 22, 2004
    #1
  2. Fatfreek

    BillZ Guest

    Hi Len,

    If you want to check your fields before the program runs, run a subr from the action tile connected with "accept" instead of a (done_dialog 1).

    (action_tile "accept" "(check_fields)")
    (action_tile "cancel" "(done_dialog 0)")

    Then at the begining of the lisp file.
    (defun check_fields ()
    (setq tile1 (get_tile "whatever")
    tile2 (get_tile "nexttile")
    )
    ;do your variable checking here.
    (if all variables check out
    (done_dialog 1)
    (prompt "\nField is not valid")
    )
    )

    Remember to set a variable from the start dialog.
    (setq answer (start_dialog))

    Then when the dialog terminates:

    (condition ((= anwer 1)
    Run all your stuff)
    )

    HTH

    Bill
     
    BillZ, Sep 22, 2004
    #2
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.