cascading combos

Started by Nima2018, March 02, 2019, 05:21:12 AM

Previous topic - Next topic

Nima2018

Hello,
I want to connect and relate two combo so that when the item is selected in the first combo, the values of the second combo are changed.


; Suppose, I have four list :

(setq lst_City (list "A" "B" "C" )
            lst_A (list "A1" "A2" "A3" )
            lst_B (list "B1" "B2" "B3" "B4" )
            lst_C (list "C1" "C2"  )
)

(COND ((= (DCL-COMBOBOX-GETCURSEL ABC_Fin/Form1/ComboBox1)
  0
       ) ;_ end of equal
       (PROGN (DCL-COMBOBOX-CLEAR ABC_Fin/Form1/ComboBox2)
      (DCL-COMBOBOX-ADDLIST
ABC_Fin/Form1/ComboBox2
lst_A
      ) ;_ end of dcl-ComboBox-AddList
       ) ;_ end of progn
      )
      ((= (DCL-COMBOBOX-GETCURSEL ABC_Fin/Form1/ComboBox1)
  1
       ) ;_ end of equal
       (PROGN (DCL-COMBOBOX-CLEAR ABC_Fin/Form1/ComboBox2)
      (DCL-COMBOBOX-ADDLIST
ABC_Fin/Form1/ComboBox2
lst_B
      ) ;_ end of dcl-ComboBox-AddList
       ) ;_ end of progn
      )
      (T
       (PROGN (DCL-COMBOBOX-CLEAR ABC_Fin/Form1/ComboBox2)
      (DCL-COMBOBOX-ADDLIST
ABC_Fin/Form1/ComboBox2
lst_C
      ) ;_ end of dcl-ComboBox-AddList
       ) ;_ end of progn
      )
) ;_ end of cond


My problem is that when I click on an item in the first Combo, nothing is visible in the second Combo.
What can I do with this problem?
Please advice me .

Nima2018

Hi friends,
Despite the fact that no one responded to this post,I was able to solve this issue below :



(DEFUN c:ABC_Fin/Form1/ComboBox1#OnSelChanged
       (ItemIndexOrCount Value /)
  (COND

    ((AND (= ItemIndexOrCount 0) (= Value (NTH 0 lst_City)))
     (PROGN (DCL-COMBOBOX-CLEAR ABC_Fin/Form1/ComboBox2)
    (DCL-COMBOBOX-ADDLIST
      ABC_Fin/Form1/ComboBox2
      lst_A
    ) ;_ end of DCL-COMBOBOX-ADDLIST
     ) ;_ end of progn
    )
    ((AND (= ItemIndexOrCount 1) (= Value (NTH 1 lst_City)))
     (PROGN (DCL-COMBOBOX-CLEAR ABC_Fin/Form1/ComboBox2)
    (DCL-COMBOBOX-ADDLIST
      ABC_Fin/Form1/ComboBox2
      lst_B
    ) ;_ end of DCL-COMBOBOX-ADDLIST
     ) ;_ end of progn
    )
    ((AND (= ItemIndexOrCount 2) (= Value (NTH 2 lst_City)))
     (PROGN (DCL-COMBOBOX-CLEAR ABC_Fin/Form1/ComboBox2)
    (DCL-COMBOBOX-ADDLIST
      ABC_Fin/Form1/ComboBox2
      lst_Rusta_C
    ) ;_ end of DCL-COMBOBOX-ADDLIST
     ) ;_ end of progn
    )
  ) ;_ end of cond
) ;_ end of defun



If One of the members has a better suggestion, please tell me.
I am not English and apologize for the mistakes in the conversations.
Thank you and have a good time .