Stumped: some sort of error when calling an onclicked function

Started by thatcadguy · 2009-07-17 13:31 UTC · 2 replies · SMF topic #852

Basically, I've made this little program and when OpenDCL calls the function:

(defun c:LayZer_Dia_AddButton_OnClicked (/)
  (LayZer_addLayers (dcl_ListBox_GetSelectedItems LayZer_Dia_Layerlist))
  (princ)
)

It produces the error: Command: ; error: invalid AutoCAD command: nil

Yet, when I run (LayZer_addLayers (dcl_ListBox_GetSelectedItems LayZer_Dia_Layerlist)) at the command prompt, the function completes successfully.

I added a prompt statement into the onclicked function to see if it was even being called and yes, it is.  For some reason OpenDCL just doesn't like calling my function when it's called from another (tried putting that statement in the closebutton_onclicked function, same error).  I've looked at my layzer_addlayers function and made sure there are no errors; made sure the layzerlayerdata list is full before it runs...don't know what to do here.  Everything should run fine but it doesn't.

Attached is everything you'll need to reproduce the error (hopefully).  Thanks in advance for any help.
Attachments
This is working as expected when Event Invoke is set to 'Synchronous'. Try changing to to 'Asynchronous', then you can call (command) from your event handlers. You might have to wait for the next build, because it fixes a bug which caused modeless dialog event handlers to ignore the Event Invoke setting.
Thanks Owen