[Closed] listview selecting all items slowdown.
Hey Paul,
i think it’s to do with the handler you are using – SelectedIndexChanged, as it is calling that each time the function loops, causing the slowdown. Could you change to your mouseup handler (for the individual mouse clicks)
on scaleListLv mouseUp senderArg arg do
(
PEN_resetXform2.selectObjectsInList scaleListLv
)
and remove the SelectedIndexChanged one? that way you could just loop the objects into an array as you set the listview selected state, thus not interfering with any events tied to the selection of a node –
fn selectAll lv state:true=
(
local sel = #()
st=timeStamp()
for i = 0 to lv.items.count-1 do
(
lv.items.item[i].selected=state
append sel lv.SelectedItems.item[i].tag.value
)
select sel
setFocus lv
ed=timeStamp()
format "selectAll: % Sec
" ((ed-st)/1000)
)
this method selects the items quickly, at any rate.
Doh!!, I should have know that as I have had similar issues in the past. Thanks a million. I’m better that will do it since each time the selection changes it goes through it again.
Just thought I was using it so you can just key up and down the list and see what objects get selected. I’ll have to rework that some how.
Yup, that was it. Just need to sort out how to work it so when the selection changes from keyboard input that it doesn’t spam it. I think I will set a flag for that.