Listview.selectedindices?

  • Thread starter Thread starter rdi
  • Start date Start date
R

rdi

the LV's multSelect prop is set to FALSE

the LV currently contains 2 items.

When I run it through the debugger I watch the SELECTEDINDICES property of
the LV.

When I select the first item in the LV, SELECTEDINDICES.Count is 1 and
SELECTEDINDICES.IndicesArray(0) is 0

Then when I select the SECOND item in the LV, SELECTEDINDICES.Count is 0 and
SELECTEDINDICES.IndicesArray just says "{Length=0}".

That's the FIRST time through the debugger.

Then when I run it through the debugger again still watching the
SELECTEDINDICES property.

When I select the SECOND item in the LV, SELECTEDINDICES.Count is 1 and
SELECTEDINDICES.IndicesArray(0) is 1

Then when I select the FIRST item in the LV, SELECTEDINDICES.Count is 0 and
SELECTEDINDICES.IndicesArray just says "{Length=0}".

It seems as thought the FIRST time I click on an item in the LV, it
correctly sets the array. When I click on a different array, it DOESN'T set
the array.
 
Hi Rdi,

This message you did send before almost in the same way, so probably nobody
can help you with the information you did give.

I have put that what you told in my IDE and than I have the first question,
what event are you using in your code where you check what is changed?

Cor
 
Cor,

I eventually figured it out:

a.. When I clicked on the item the first time, the "SelectedItem" event fired and selectedindices contains ONE item.
b.. When I clicked on the item the second time, the "SelectedItem" even fired again--because the first was now de-selected. Which is why selectedindices contained ZERO items.
c.. Then the event fired again because the second item was now selected and selectedindices contains ONE item again.
Added the following to my event handler to figure out which state I was in:

if selectedindices.count > 0 then
'some code to process as though one or more items is/are selected
end if

As a result nothing happens during the "DeSelect" stage.

Thanks.
 
Back
Top