I have a function called "filter". When I click an item in a treeview, a listview to its right displays up to 6290 entries limited by a search criteria.
The function first delete the old list, then make a "for loop" through my main index. If an item in the index match the search criteria its added to the listview.
What I cannot do is to break the former loop when a new "filter" is added. If the "All" option is used, meant to display every entry in the index, the script blatantly ignore all new calls of Filter until it finished building the list of all 6290 entries.
Any idea how I can make it stop the old for loop when I call a new one?
I added a smaller version of the function as it is to illustrate what it looks like. I tried to add a "LoopBreak" variable that was checked right prior to the "All" filter, meant to break the loop, but I couldn't get it to work.
Code: Select all
Filter(Filter,Category:="None") ; This is the main Filter script
{
global
LV_Delete()
for ID, info in Index
If (Filter = "All") and ConfigurationIndex[ID].ConfTitle ; All
LV_Add("", info.Game,ID,SubStr(info.Year, -3),info.Publisher,info.Developer,info.Genre,info.SourceCount)
else if (Category = "Year") and ConfigurationIndex[ID].ConfTitle and (SubStr(info.Year, -3) = Filter) ; Year
LV_Add("", info.Game,ID,SubStr(info.Year, -3),info.Publisher,info.Developer,info.Genre,info.SourceCount)
else if (Category = "Year") and ConfigurationIndex[ID].ConfTitle and (Filter = "Earlier") and info.Year and (SubStr(info.Year, -3) < 1981) ; Year
LV_Add("", info.Game,ID,SubStr(info.Year, -3),info.Publisher,info.Developer,info.Genre,info.SourceCount)
else if (Category = "Year") and ConfigurationIndex[ID].ConfTitle and (Filter = "Later") and info.Year and (SubStr(info.Year, -3) > 2001) ; Year
LV_Add("", info.Game,ID,SubStr(info.Year, -3),info.Publisher,info.Developer,info.Genre,info.SourceCount)
else if (Category = "Genre") and ConfigurationIndex[ID].ConfTitle and inStr(info.Genre,Filter) ; Genre
LV_Add("", info.Game,ID,SubStr(info.Year, -3),info.Publisher,info.Developer,info.Genre,info.SourceCount)
}