Color Swatch code does not work anymore

Started by RGUS · 2018-08-22 21:55 UTC · 4 replies · SMF topic #2626

Years ago, I had some great help from people here to create a color swatch using OpenDCL. It was awesome!
Now with ACAD 2019.1 Version P103.0.0 and OpenDCL Version 9.0.1.5, It doesn't close the dialog box anymore.

I have tried all sorts of syntax with the (Dcl-Form-Close), but nothing closes the dialog box.

I'm sure I'm doing something basically wrong, but what use to work in previous versions of ACAD and OpenDCL no longer does.
Any pointers and slapping about my face would be appreciated.
Attachments
Hi,

these are the problematic lines:
(Defun Colorbuttononclick (Index)
(command "color" Index)
(Dcl-Form-Close SWATCH/SWATCH)
)


Beginning with AutoCAD 2015 you are forced to finish event right before calling commands. It matches to many forum topics and my answer alsways is: don't leave the car before stopping it! Means: don't start any command until any event function has completely finished. You have either to switch the event invoke of every button to Allow command or move the (command ...)-line outside the event or use ActiveX-functions instead of commands.

Buttons in modeless forms the Event Invoke=KeepFocus have to be handled similar to buttons in modal forms.
Hope that helps.
Regards, Fred
author=Fred Tomke link=topic=2626.msg12970#msg12970 date=1534976508 wrote:
Hi,

these are the problematic lines:
(Defun Colorbuttononclick (Index)
(command "color" Index)
(Dcl-Form-Close SWATCH/SWATCH)
)


Beginning with AutoCAD 2015 you are forced to finish event right before calling commands. It matches to many forum topics and my answer alsways is: don't leave the car before stopping it! Means: don't start any command until any event function has completely finished. You have either to switch the event invoke of every button to Allow command or move the (command ...)-line outside the event or use ActiveX-functions instead of commands.

Buttons in modeless forms the Event Invoke=KeepFocus have to be handled similar to buttons in modal forms.
Hope that helps.
Regards, Fred


Thanks for the quick response Fred.
I just have no idea what "switch the event invoke of every button to Allow command" means or how to do this in the OpenDCL Studio.
Why doesn't the EXIT function work when there is no 'command' called inside the function or outside.

(defun c:SWATCH/SWATCH/EXIT#OnClicked (/)
(dcl-Form-Close SWATCH/SWATCH)
)

It doesn't close the dialog box when clicked.

I'm too scared to ask much more in case I'm thrashed with a big stick.
Hi, your exit button works for me.
To be honest, I didn't look at your odcl file yesterday. I've just seen that all your buttons are already set to AllowCommand.
In the end I started your project - and it works like a charm. So where is the problem?
Regards, Fred
Attachments
author=Fred Tomke link=topic=2626.msg12973#msg12973 date=1534998041 wrote:
Hi, your exit button works for me.
To be honest, I didn't look at your odcl file yesterday. I've just seen that all your buttons are already set to AllowCommand.
In the end I started your project - and it works like a charm. So where is the problem?
Regards, Fred


Thanks, Fred,
I just got home and tried it on my machine here, and yes all is good. There must be a bad installation of something at work. Frustrating, but I'll find it.
Thanks so much for your input and help.