Author Topic: Fail to add text into combobox in modal dialog  (Read 676 times)

EricTang

  • Member
  • *
  • Posts: 3
Fail to add text into combobox in modal dialog
« on: May 11, 2022, 10:10:23 PM »
Greetings to all  :)! I am new to openDCL, and I may need some help in the development.

I have a modal dialog with a combobox inside. My task is to add a list of text into the combobox. However, the combobox seems unchanged, and a runtime error occurs after closing the dialog: "Error: NIL value not allowed; Function: dcl-Control-SetList". The reason could be the inproper settings to the modal dialog, since when I executed the same code in a modeless dialog, it worked. But I don't know what is going wrong in my modal dialog. I appreciate it if anyone can give some help.

Here is my code:
(dcl-Form-Show New/SettingDlg)
(setq testlst '("1" "2" "3"))
(dcl-Control-SetList New/SettingDlg/Layer1Cmbbox testlst)

roy_043

  • Sr. Member
  • ****
  • Posts: 380
Re: Fail to add text into combobox in modal dialog
« Reply #1 on: May 13, 2022, 12:00:12 AM »
The dcl-Control-SetList function needs to be called in the OnInitialize event handler function. Take a look at ListView.lsp in the Samples folder:
C:\Program Files (x86)\OpenDCL Studio\ENU\Samples\Tree.lsp

EricTang

  • Member
  • *
  • Posts: 3
Re: Fail to add text into combobox in modal dialog
« Reply #2 on: May 14, 2022, 10:14:35 PM »
Thanks for your help. It works. However, I still wonder what if I want to change the content of a combobox when the dialog is already shown?

roy_043

  • Sr. Member
  • ****
  • Posts: 380
Re: Fail to add text into combobox in modal dialog
« Reply #3 on: May 15, 2022, 10:57:17 PM »
Since it's a modal dialog you would do that with event handler functions as well. The Grid.lsp file will give you an idea how this works.