Author Topic: ObjectDCL bug?  (Read 434 times)

ziele_o2k

  • Member
  • *
  • Posts: 10
ObjectDCL bug?
« 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:
Code: [Select]
(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:
Code: [Select]
(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
« Last Edit: April 08, 2021, 02:11:48 PM by ziele_o2k »

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: ObjectDCL bug?
« Reply #1 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.

ziele_o2k

  • Member
  • *
  • Posts: 10
Re: ObjectDCL bug?
« Reply #2 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:
Code: [Select]
(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.
Code: [Select]
(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:
Code: [Select]
(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

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #3 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?

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: ObjectDCL bug?
« Reply #4 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 ...

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #5 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

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #6 on: May 24, 2021, 12:44:17 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

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #7 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.

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #8 on: June 04, 2021, 11:33:24 AM »
Please nobody has an answer to this problem?

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: ObjectDCL bug?
« Reply #9 on: June 05, 2021, 07:17:05 AM »
I answered on May 22.

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #10 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.

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #11 on: June 06, 2021, 04:41:31 AM »
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?
« Last Edit: June 06, 2021, 01:28:50 PM by velasquez »

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: ObjectDCL bug?
« Reply #12 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.

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: ObjectDCL bug?
« Reply #13 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.

velasquez

  • Hero Member
  • *****
  • Posts: 501
Re: ObjectDCL bug?
« Reply #14 on: June 08, 2021, 01:11:24 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
« Last Edit: June 08, 2021, 01:22:32 PM by velasquez »