ObjectDCL bug?

Started by ziele_o2k, April 08, 2021, 02:09:16 PM

Previous topic - Next topic

ziele_o2k

I'm working with small project and I have some error which I don't understand:
This code is ok:
(defun c:CalculateReinforcement/Zginanie/TabStrip1#OnChanged (ItemIndex /)
    (cond
        ((= ItemIndex 0)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox4 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox3 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox7 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox8 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox9 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox1 T)
         ;(dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 103)
        )
        ((= ItemIndex 1)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox4 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox3 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox7 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox8 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox9 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox1 T)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 101)
        )
        ((= ItemIndex 2)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox4 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox3 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox7 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox8 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox9 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox1 nil)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 102)
        )
    )
    (princ)
)

But this one:
(defun c:CalculateReinforcement/Zginanie/TabStrip1#OnChanged (ItemIndex /)
    (cond
        ((= ItemIndex 0)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox4 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox3 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox7 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox8 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox9 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox1 T)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 103)
        )
        ((= ItemIndex 1)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox4 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox3 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox7 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox8 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox9 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox1 T)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 101)
        )
        ((= ItemIndex 2)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox4 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/ComboBox3 T)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox7 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox8 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox9 nil)
         (dcl-Control-SetEnabled CalculateReinforcement/Zginanie/TextBox1 nil)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 102)
        )
    )
    (princ)
)
end with error when dcl_Form_Show jums in

Edit:
Win10, AC2022

owenwengerd

The error tells you that CalculateReinforcement/Zginanie/ZginanieIMG is NIL, which indicates some mistake in the control symbol. You can copy and paste the symbol name from the Studio property pane to be sure you have it right.

ziele_o2k

Thanks Owen for quick replay, but in my opinion code I posted is fine.
When window is loading this event is triggered:
(defun c:CalculateReinforcement/Zginanie#OnInitialize (/)
    (...)
    (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 103)
    (princ)
)

And it work ok.
This event works ok but when loading, OpenDCL returns error I posted earlier.
(defun c:CalculateReinforcement/Zginanie/TabStrip1#OnChanged (ItemIndex /)
    (cond
        ((= ItemIndex 0)
         (...)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 103)
        )
        ((= ItemIndex 1)
         (...)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 101)
        )
        ((= ItemIndex 2)
         (...)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 102)
        )
    )
    (princ)
)

Code below do not trigger error on load:
(defun c:CalculateReinforcement/Zginanie/TabStrip1#OnChanged (ItemIndex /)
    (cond
        ((= ItemIndex 0)
         (...)
         ;(dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 103)
        )
        ((= ItemIndex 1)
         (...)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 101)
        )
        ((= ItemIndex 2)
         (...)
         (dcl-Control-SetPicture CalculateReinforcement/Zginanie/ZginanieIMG 102)
        )
    )
    (princ)
)


Edit:
Tested on: Win10 AC2021 ZW2015 GStar2018

velasquez

Hello ziele_o2k I have the same problem.
But it's happening on different machines with AutoCAD 2021.
Did you manage to solve it?

owenwengerd

It sounds like OnChanged event is firing before the symbol names are set. I would just check the symbol name, i.e. (if CalculateReinforcement/Zginanie/ZginanieIMG (cond ...

velasquez

After testing I discovered my problem with the old symbol names, in AutoCAD 2021 and 2022.
I updated the names and the problem ended on my computer, I will test it on another device

;;;Before
dcl_Control_SetPicture
;;;After
dcl-Control-SetPicture

;;;Before
dcl_ListBox_Clear
;;;After
dcl-ListBox-Clear

;;;Before
dcl_ComboBox_Clear
;;;After
dcl-ComboBox-Clear

velasquez

Quote from: velasquez on May 22, 2021, 01:24:47 PM
After testing I discovered my problem with the old symbol names, in AutoCAD 2021 and 2022.
I updated the names and the problem ended on my computer, I will test it on another device

;;;Before
dcl_Control_SetPicture
;;;After
dcl-Control-SetPicture

;;;Before
dcl_ListBox_Clear
;;;After
dcl-ListBox-Clear

;;;Before
dcl_ComboBox_Clear
;;;After
dcl-ComboBox-Clear

These errors keep happening on my client's computer, I can't understand why.
Any ideas for testing?

velasquez

I haven't seen these problems with older versions of OpenDCL Studio, but I don't have anything to test.

velasquez

Please nobody has an answer to this problem?

owenwengerd


velasquez

Sorry I didn't understand your answer.
Everything worked fine until AutoCAD 2019, the problem happened from AutoCAD 2021 without anything being changed.
I'm updating all the names to the new pattern, it looks like that's the only solution.

velasquez

#11
Quote from: owenwengerd on May 21, 2021, 11:24:21 PM
It sounds like OnChanged event is firing before the symbol names are set. I would just check the symbol name, i.e. (if CalculateReinforcement/Zginanie/ZginanieIMG (cond ...

I have a foreach with many symbol names to change the index of the image.
Do I need to check them all?

owenwengerd

If the problem is related to old style symbols no longer being define, then my answer would not be helpful. I'm not aware of a problem with the old style symbol names, but it may well have gone unnoticed. I'll make a note to check this in Acad 2021.

owenwengerd

I did a quick test, but I don't see any problem with function names in Acad 2021 with OpenDCL Runtime 9.1.3.0. For example, both dcl-Control-SetPicture and dcl_Control_SetPicture are defined and point to the same function. Additionally, the fact that you get an error about the function *argument* proves that the function itself is defined and executed.

velasquez

#14
Quote from: owenwengerd on June 08, 2021, 12:14:58 PM
I did a quick test, but I don't see any problem with function names in Acad 2021 with OpenDCL Runtime 9.1.3.0. For example, both dcl-Control-SetPicture and dcl_Control_SetPicture are defined and point to the same function. Additionally, the fact that you get an error about the function *argument* proves that the function itself is defined and executed.

Everything works fine on my computer with AutoCAD 2021 and 2022, I've updated all the function and control names.
But on my client's computer with AutoCAD 2021 the errors happen with dcl-Control-SetPicture or dcl_Control_SetPicture.
The error also happens with  (dcl-ComboBox-Clear EstudoPlanos/Canaliza