FXIconList with frequent changes

M

martinus

Hi, I am writing an application where I add, remove and modify random
items of an FXIconList quite frequently. The only possible way i know
to remove an item is through the index number. Unfortunately, whenever
I add/modify + sort the list, the index changes; and I have to do a
linear search to find the item I want to remove, which is painfully
slow. Does anyone know a better way to do this? I use fxruby 1.0.
martinus
 
L

Lyle Johnson

Hi, I am writing an application where I add, remove and modify random
items of an FXIconList quite frequently. The only possible way i know
to remove an item is through the index number. Unfortunately, whenever
I add/modify + sort the list, the index changes; and I have to do a
linear search to find the item I want to remove, which is painfully
slow. Does anyone know a better way to do this?

Right offhand, I don't think there's an easy fix, other than perhaps
storing the items' indices as their user data (and of course updating
each item's data ever time you make a change to the list that would
disrupt the indices. What kind of identifying information about the
item do you have when you get ready to remove it? Or do you have a
reference to the item itself?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top