Author Topic: How to trigger a dropdown OnSelChanged event?  (Read 43 times)

A. van Dalen

  • Member
  • *
  • Posts: 1
How to trigger a dropdown OnSelChanged event?
« on: November 13, 2017, 07:04:53 AM »
Beste Member OpenDCL,

Can you help me with my code? Im starting to learn coding lisp/opendcl i have an issue with updating my value of Textbox1. I made a presset for my combobox but didn't work fine. See the code bellow. When the checkbox is checked the dcl-ComboBox-SetCurSel set my preset to the combox it works. The combobox update my textbox also without a probleme. But when thecombobox is preset by checkbox it  doesn't update my textbox?
How can i trigger the OnSelChanged event witout duplicate function dcl-Control-SetText?

Thank you help and time,

Alwin

Code: [Select]
(defun c:HelloWorld/Form1/ComboBox1#OnSelChanged (ItemIndexOrCount Value /)
   (cond
     ((= ItemIndexOrCount 0)
(dcl-Control-SetText HelloWorld/Form1/Textbox1 "test1")
     )
     ((= ItemIndexOrCount 1)
(dcl-Control-SetText HelloWorld/Form1/layername "test2")
     )
)
(defun c:HelloWorld/Form1/chkKeuze1#OnClicked (1/)
(dcl-ComboBox-SetCurSel HelloWorld/Form2/status2 1)
)

roy_043

  • Sr. Member
  • ****
  • Posts: 326
Re: How to trigger a dropdown OnSelChanged event?
« Reply #1 on: November 13, 2017, 12:40:58 PM »
Welcome to the forum.

Sorry to disappoint you but what you want is not possible:
Note that OnSelChanged is triggered only when the selection is changed by user interaction; it is not called when the selection is changed programmatically.