Erick J. Bourgeois wrote: > I wish to prevent the user from choosing more than one item > in a Listview and since I didn't find an option > for -multisel, like in a ListBox, I have attempted to > achieve this through the ItemClick event for a ListView. > > sub ListView_ItemClick { > if ($Win->ListView->SelectCount() > 1) { > Win32::MsgBox("You can not pick more than one > item!", 48, "Choose Only One"); > $Win->ListView->Select(0); > return; > } > } > > This displays the MsgBox great the first time, however it > then loops back and displays it again, it fact, I believe it > displays the MsgBox 2**(amount of selected items) times (ie. > 2 to the power of). As you may see I tried Selecting the > first item so the sub won't be called again. Any ideas?
yes, doing a: $Win->ListView->Select(0); really fires an ItemClick event on the ListView, so you're in a loop. you can use the -singlesel option on the ListView to achieve what you want. cheers, Aldo __END__ $_=q,just perl,,s, , another ,,s,$, hacker,,print;