SetCurSel based off another Listbox

Started by dsm_dude, August 23, 2022, 01:57:23 PM

Previous topic - Next topic

dsm_dude

I have two list boxes in my dialog box.

One contains a description and the other a VBScript.

When I select the desired description it automatically selects the VBScript.

This is how I'm accomplishing it, but I would like to know if there is a better and more streamlined way to accomplish this.
(defun c:LabelContent/Form1/ListBox2#OnSelChanged (ItemIndexOrCount Value /)
  (setq Usel (dcl-ListBox-GetCurSel LabelContent/Form1/ListBox2))
  (cond
    ((= Usel 0)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 0))
    ((= Usel 1)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 1))
    ((= Usel 2)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 2))
    ((= Usel 3)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 3))
    ((= Usel 4)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 4))
    ((= Usel 5)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 5))
    ((= Usel 6)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 6))
    ((= Usel 7)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 7))
    ((= Usel 8)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 8))
    ((= Usel 9)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 9))
    ((= Usel 10)(dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 10))
);cond
  )

Fred Tomke

Hi, does this the trick?


(defun c:LabelContent/Form1/ListBox2#OnSelChanged (ItemIndexOrCount Value /)
  (dcl-ListBox-SetCurSel LabelContent/Form1/ListBox1 ItemIndexOrCount)
)


Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

dsm_dude

Fred,

You are the man. I knew there was a better way!!

Thank you!!