New OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: JBerns on June 05, 2019, 07:32:43 AM

Title: Command versus Function definition for routines
Post by: JBerns on June 05, 2019, 07:32:43 AM
Community,

I am a new user to OpenDCL, but a 30-year developer of AutoLISP code.

I noticed that when creating events for forms, boxes, buttons etc., the routines are defined as Command functions. For example:
Code: [Select]
(defun c:Sample_01/Form1#OnInitialize (/) ...
(defun c:Sample_01/Form1/Label1#OnClicked (/) ...
(defun c:Sample_01/Form1/TextButton1#OnClicked (/) ...

Is it necessary to define these routines as Command (C:) functions? Users who prefer to type commands will see a lot of extra commands, which may be confusing.
See attached image.

I would have expected supporting routines to be defined as functions. In other words, without the "C:". This would be less confusing for typed commands.

I would welcome an explanation as to why all the routines are defined as Commands instead of mostly as Functions.


Kind regards,

Jerry
Title: Re: Command versus Function definition for routines
Post by: roy_043 on June 05, 2019, 12:23:59 PM
See here:
http://opendcl.com/forum/index.php?topic=2539.msg12604#msg12604
Title: Re: Command versus Function definition for routines
Post by: JBerns on June 13, 2019, 06:31:47 AM
Localizing the supporting functions (OnClick, OnReturnPressed, etc.) inside the main function worked great!

I have used this nesting method before for functions, but never command functions. I should have thought of that solution myself.  ::)

Thanks for the assistance.


Regards,
Jerry
Title: Re: Command versus Function definition for routines
Post by: roy_043 on June 13, 2019, 06:46:29 AM
Your experience then differs from dan113's in the linked topic. Are the functions still 'hidden' in AutoCAD after calling the parent function?