OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Kerry on December 16, 2014, 02:31:43 PM

Title: Localizing ODCL event AutoLisp function names.
Post by: Kerry on December 16, 2014, 02:31:43 PM
[search comment]  localize = localise


Should/can Autolisp Event function names be localized ?
Is there a definitive article somewhere regarding this.
ie:
Code (autolisp) Select


(defun c:doit( /
                     *error*
                      c:3D-Plate/F#OnInitialize
                       ;; variables
                       local-varThingy

                     )
   (defun c:3D-Plate/F#OnInitialize (/)
     (dcl-MessageBox "To Do: code must be added to event handler\r\nc:3D-Plate/F#OnInitialize" "To do")
   )

   (princ)
)
(princ)


Any specific recommendations, warnings, best practice

Regards,
Title: Re: Localizing ODCL event AutoLisp function names.
Post by: owenwengerd on December 16, 2014, 03:04:14 PM
See the Style Guidelines (http://www.opendcl.com/HelpFiles/index.php?page=Usage/AutoLISP.htm) section in the documentation. The samples are intended to demonstrate the best practice. They *can* be localized as long as you're certain that they will be defined when they are fired, but I don't recommend it. For one, it causes a performance hit. Second, it's easy for newbies to get tripped up and end up with events firing after the handler has already gone out of scope.
Title: Re: Localizing ODCL event AutoLisp function names.
Post by: Kerry on December 16, 2014, 06:58:16 PM

Thanks Owen. I'll have a read tonight.