User Tools

Site Tools


This is an old revision of the document!

A PCRE internal error occured. This might be caused by a faulty plugin

=====Finding which items are selected in a List View===== //by Richard Russell, September 2010//\\ \\ A significant difference between a **List View** and a **List Box** is that the former allows you to select **multiple** items whereas the latter only allows you to select a **single** item. This complicates somewhat the issue of discovering which item(s) is/are selected.\\ \\ With a **List Box** you can simply send the **LB_GETCURSEL** message:\\ SYS "SendMessage", hListBox%, LB_GETCURSEL, 0, 0 TO sel% where **sel%** is set to the index of the current selection (or -1 if no item is selected).\\ \\ With a **List View** you can optionally discover how many items are selected as follows:\\ SYS "SendMessage", hListView%, LVM_GETSELECTEDCOUNT, 0, 0 TO nsel% where **nsel%** is set to the number of selected items.\\ \\ To find which item(s) is/are selected you can send the List View the **LVM_GETNEXTITEM** message:\\ iStart% = -1 SYS "SendMessage", hListView%, LVM_GETNEXTITEM, iStart%, LVNI_SELECTED TO index% where **index%** is set to the index of the first item selected (or to -1 if no items are selected).\\ \\ To discover which other items (if any) are selected send the message repeatedly with **iStart%** set to the index previously returned, until **index%** is -1:\\ iStart% = -1 REPEAT SYS "SendMessage", hListView%, LVM_GETNEXTITEM, iStart%, LVNI_SELECTED TO index% IF index% <> -1 THEN PROC_do_something(index%) iStart% = index% UNTIL index% = -1 Use the **Windows Constants** [[/Tools%20and%20Utilities|utility]] or **API Viewer** to discover the values of the constants.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
finding_20which_20items_20are_20selected_20in_20a_20list_20view.1522502362.txt.gz · Last modified: 2018/03/31 14:19 by