Author Topic: Automatically Select (highlight) Listbox Item  (Read 15178 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Automatically Select (highlight) Listbox Item
« Reply #15 on: October 05, 2007, 06:59:29 PM »
There is short example.

Can you post it as a ZIP instead of a RAR?

Matt,
here's the essential code ASMI posted ..
Code: [Select]
;;
;; For the example, assume the ARX is loaded
;;


(defun c:swtest ()
  (if (not (dcl_project_load "SWTest" t))
    (progn (alert (strcat "SWTest ERROR!" "Can't load file: SWTest.odcl"))
           (quit)
    )
    (progn (dcl_form_show SWTest_Form1))
  )
  (princ)
)


(defun c:SWTest_Form1_TextButton4_OnClicked (/ rValue)
  (if (/= -1
          (setq rValue (dcl_listbox_findstringexact
                         SWTest_Form1_ListBox1
                         (dcl_control_gettext SWTest_Form1_TextBox2)
                       )
          )
      )
    (dcl_listbox_setcursel SWTest_Form1_ListBox1 rValue)
    (alert "There isn't that string!")
  )
  (princ)
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Automatically Select (highlight) Listbox Item
« Reply #16 on: October 05, 2007, 07:04:13 PM »

.. this of course finds the FULL exact string if it exists,
use (dcl_ListBox_FindString ... if you are looking for a match with partial data .. but that will also require a 'Next Match' option be coded.

/// kwb
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ASMI

  • Guest
Re: Automatically Select (highlight) Listbox Item
« Reply #17 on: October 08, 2007, 05:01:14 AM »
Code: [Select]
Can you post it as a ZIP instead of a RAR?