Fail to add text into combobox in modal dialog

Started by EricTang, May 11, 2022, 10:10:23 PM

Previous topic - Next topic

EricTang

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

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

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

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.