OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: dsm_dude on August 23, 2022, 01:57:23 PM

Title: SetCurSel based off another Listbox
Post by: dsm_dude on August 23, 2022, 01:57:23 PM
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
  )
Title: Re: SetCurSel based off another Listbox
Post by: Fred Tomke on August 23, 2022, 04:18:17 PM
Hi, does this the trick?


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


Regards, Fred
Title: Re: SetCurSel based off another Listbox
Post by: dsm_dude on October 31, 2022, 01:51:44 PM
Fred,

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

Thank you!!