Crashing after closing form

Started by leo9 · 2016-09-19 12:55 UTC · 2 replies · SMF topic #2426

Hi,

Am trying to run some simple code when user clicks OK but it crashes AutoCAD.  The OK button should run some code and close the form:

(defun c:CM_Admin/frmCMAdmin/txtButton_OK#OnClicked (/)
  (dcl-Form-Close CM_Admin/frmCMAdmin)
    (if logo_name
    (progn
      (insert_logo logo_name)
    )
  )
)

Sorry for these very basic questions but not getting very far.
I have go it working by setting the OK button return value to 3:

(dcl-Form-Close CM_Admin/frmCMAdmin 3)

Then check the return value when showing the form:

(setq return (dcl_Form_Show CM_Admin_frmCMAdmin))

(if (= return 3) (etc...
Hi, yes you are right: it's similar to the faq: http://www.opendcl.com/forum/index.php?topic=1080.0.
Regards, Fred