OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: TopoWAR on August 27, 2014, 12:56:24 PM

Title: select a position in a list box
Post by: TopoWAR on August 27, 2014, 12:56:24 PM
Hi, I have a question, in a list box you want to select a position x, in this case "Número  YX" but I select "Número  YXZ" how do I select the position you want on the list?

Code (autolisp) Select
(list "Número X Y Z Descripción"
      "Número Y X Z Descripción"
      "Número X Y Z"
      "Número Y X Z"
      "Número X Y Descripción"
      "Número Y X Descripción"
      "Número X Y"
      "Número Y X"
      "X Y Z Descripción"
      "Y X Z Descripción"
      "X Y Z"
      "Y X Z"
      "X Y Descripción"
      "Y X Descripción"
      "X Y"
      "Y X")


I have dealt with these you run but do not give me the result I want

thank you
Code (autolisp) Select
(dcl-ListBox-SelectString TopoWAR/form_exp/formato "Número Y X")
(dcl-ListBox-SelectItem TopoWAR/form_exp/formato 7 t)


for now I solved using a loop to find the position I seek
Code (autolisp) Select
(setq cont -1)
    (while (/= (dcl-ListBox-SelectString TopoWAR/form_exp/formato (setq formato_t (nth formato_n formato)) cont) formato_n)
      (setq cont (1+ cont))
    )
Title: Re: select a position in a list box
Post by: DW on August 27, 2014, 07:35:23 PM
I ran into the same problem before - how about...

Code (autolisp) Select
(dcl_ListBox_SelectItem TopoWAR/form_exp/formato (dcl_ListBox_FindStringExact TopoWAR/form_exp/formato  "Número  YX" ) t )
Title: Re: select a position in a list box
Post by: TopoWAR on August 27, 2014, 07:47:36 PM
what I need is to select an item in the list, I mark it in the list, the previous loop I fixed that,
Title: Re: select a position in a list box
Post by: owenwengerd on August 27, 2014, 09:22:19 PM
You didn't say whether this is a single-selection or multiple-selection style listbox. Are you perhaps looking for (dcl-ListBox-SetCurSel) (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Method/ListBox/SetCurSel.htm)?
Title: Re: select a position in a list box
Post by: Fred Tomke on August 27, 2014, 09:53:31 PM
Hi, the right function depends on the listbox selection type. Use SetCurSel in SingleSelection ListBox, SelectItem in MultiSelection typed listboxes.
Regards, Fred