OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: ziele_o2k on April 08, 2021, 02:09:16 PM

Title: ObjectDCL bug?
Post by: ziele_o2k on April 08, 2021, 02:09:16 PM
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
Title: Re: ObjectDCL bug?
Post by: owenwengerd on April 08, 2021, 07:40:04 PM
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.
Title: Re: ObjectDCL bug?
Post by: ziele_o2k on April 08, 2021, 11:04:38 PM
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
Title: Re: ObjectDCL bug?
Post by: velasquez on May 21, 2021, 04:32:50 AM
Hello ziele_o2k I have the same problem.
But it's happening on different machines with AutoCAD 2021.
Did you manage to solve it?
Title: Re: ObjectDCL bug?
Post by: 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 ...
Title: Re: ObjectDCL bug?
Post by: 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
Title: Re: ObjectDCL bug?
Post by: velasquez on May 24, 2021, 12:44:17 PM
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?
Title: Re: ObjectDCL bug?
Post by: velasquez on May 24, 2021, 12:58:37 PM
I haven't seen these problems with older versions of OpenDCL Studio, but I don't have anything to test.
Title: Re: ObjectDCL bug?
Post by: velasquez on June 04, 2021, 11:33:24 AM
Please nobody has an answer to this problem?
Title: Re: ObjectDCL bug?
Post by: owenwengerd on June 05, 2021, 07:17:05 AM
I answered on May 22.
Title: Re: ObjectDCL bug?
Post by: velasquez on June 06, 2021, 03:59:10 AM
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.
Title: Re: ObjectDCL bug?
Post by: velasquez on June 06, 2021, 04:41:31 AM
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?
Title: Re: ObjectDCL bug?
Post by: owenwengerd on June 08, 2021, 11:39:16 AM
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.
Title: Re: ObjectDCL bug?
Post by: 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.
Title: Re: ObjectDCL bug?
Post by: velasquez on June 08, 2021, 01:11:24 PM
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
Title: Re: ObjectDCL bug?
Post by: serrano on July 06, 2021, 09:00:33 AM
These errors happen if the LispSys variable in AutoCAD 2021 and 2022 is set to 1 or 2.