I have an array “X” of N objects (where N is about 175) amongst other attributes, each has a boolean flag value
Each time the user performs an operation (key, mouse etc) various other objects change state (for example a text string changes)
then based on a number of criteria between 0 and 50 of those first mentioned objects set to false (and all others are reset to true if required)
What I am trying to figure out is the fastest way to do this.
Array “X” never changes in size once the app starts
the number of items in Array “X” that need to be set to false is very dynamic, and needs to be updated whenever the user performs a key or mouse down action
my current method is to create a dynamic array “Y” of all the “X” items tags that need to be set to false and then do something like
// // code goes here to create "Y" based on time specific criteria // // for i = 0 to X.ubound x(i).flag=true for j=0 to Y.ubound if Y(j)=X(i).tag then x(i).flag=false next j next i
while that works, it is very slow and the lag is perceptible to the user
The unfortunate thing is that “X” may have up to 5 items all with the same tag value and their position within “X” is not ordered
I thought about using a Dictionary, but that requires a unique “key” so I can’t have 5 items tagged the same (and those tag values have meaning elsewhere in the app)
Another idea was to set the flag as each criteria was checked, but that took the same amount of time, just spread it out more
the only other idea I have is to leave “X” an array, and make “Y” a dictionary,
for i=0 to X.Ubound X(i).flag=NOT (y.hasKey(x(i).tag)) next i
Anyone have any better ideas???