Color Swatch code does not work anymore

Started by RGUS, August 22, 2018, 02:55:40 PM

Previous topic - Next topic

RGUS

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.

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

RGUS

Quote from: Fred Tomke on August 22, 2018, 03:21:48 PM
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.

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

RGUS

Quote from: Fred Tomke on August 22, 2018, 09:20:41 PM
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.