select a position in a list box

Started by TopoWAR · 2014-08-27 19:56 UTC · 4 replies · SMF topic #2164

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?

(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
(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
(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))
    )
I ran into the same problem before - how about...

(dcl_ListBox_SelectItem TopoWAR/form_exp/formato (dcl_ListBox_FindStringExact TopoWAR/form_exp/formato  "Número  YX" ) t )
what I need is to select an item in the list, I mark it in the list, the previous loop I fixed that,
You didn't say whether this is a single-selection or multiple-selection style listbox. Are you perhaps looking for {2}?
Hi, the right function depends on the listbox selection type. Use SetCurSel in SingleSelection ListBox, SelectItem in MultiSelection typed listboxes.
Regards, Fred