Author Topic: Can't use Autolisp functions with Modeless or palette  (Read 7348 times)

0 Members and 1 Guest are viewing this topic.

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Can't use Autolisp functions with Modeless or palette
« 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:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Can't use Autolisp functions with Modeless or palette
« Reply #1 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.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: Can't use Autolisp functions with Modeless or palette
« Reply #2 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.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Can't use Autolisp functions with Modeless or palette
« Reply #3 on: December 06, 2015, 08:14:32 PM »
I think the Modal vs. Modeless section of the help file is what Kerry is looking for.

arion279

  • Mosquito
  • Posts: 1
Re: Can't use Autolisp functions with Modeless or palette
« Reply #4 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.