TheSwamp

Code Red => Visual DCL Programming => AutoLISP (Vanilla / Visual) => OpenDCL => Topic started by: Tharwat on December 06, 2015, 02:06:33 AM

Title: Can't use Autolisp functions with Modeless or palette
Post by: Tharwat on December 06, 2015, 02:06:33 AM
Hello,

I am having a fatal error with the Modeless form and palette as well with trying to draw a simple circle or even line and after the message AutoCAD crash. Could anyone have a look?

Attached the simple Modeless from.

Thanks in advance.

Code - Auto/Visual Lisp: [Select]
  1. (command "OPENDCL")
  2. (defun c:Test (/)
  3.   (dcl-project-load "DrawCircle")
  4.   (dcl-form-show DrawCircle/Form1)
  5.   )
  6.  
  7. (defun c:DrawCircle/Form1/TextButton1#OnClicked (/)
  8.   (and (setq p1 (getpoint "\nSpecify 1st point :"))
  9.        (setq p2 (getpoint "\nNext point :" p1))
  10.        (entmakex (list '(0 . "CIRCLE")(cons 10 p1) (cons 40 (distance p1 p2))))
  11.        )            
  12. )
  13.  
  14. (defun c:DrawCircle/Form1/TextButton2#OnClicked (/)
  15.   (dcl-form-close DrawCircle/Form1)
  16. )
  17.  

Fatal error message:
Title: Re: Can't use Autolisp functions with Modeless or palette
Post by: Kerry on December 06, 2015, 03:03:59 AM
It's too long since I've done this stuff.
.... and it always confused me.

Modeless dialogs
Event-Invoke
Synchronous
Asynchronous
dcl-invoke
dcl-SendString etc.
Something about Ctrl-C in the EventHandler.

I can't recall where the documentation is for this modeless stuff

Perhaps Owen can help if he comes along.

Title: Re: Can't use Autolisp functions with Modeless or palette
Post by: Tharwat on December 06, 2015, 05:16:17 AM
Thanks kerry .

Yeah , you were right , it is a matter with EventInvoke and it has to be set to 1 - Asynchronous .

Have a nice day.
Title: Re: Can't use Autolisp functions with Modeless or palette
Post by: owenwengerd on December 06, 2015, 08:14:32 PM
I think the Modal vs. Modeless (http://www.opendcl.com/HelpFiles/index.php?page=Concepts/Modality.htm) section of the help file is what Kerry is looking for.
Title: Re: Can't use Autolisp functions with Modeless or palette
Post by: arion279 on January 27, 2022, 02:43:49 AM
This helped me a lot finding this thread: "EventInvoke and it has to be set to 1 - Asynchronous". If you are using OpenDCL and saving the settings to xrecords, you need to make the button that calls the event function referencing (entmakex) inside of it "EventInvoke = 1 - Asynchronous" for (entmakex) to work. Otherwise you end up in a maddening troubleshooting condition where the code implementing entmakex should work as normal but doesn't.