Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need optimization ideas
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Need optimization ideas
Divers
Thread ID:
00828770
Message ID:
00828770
Vues:
53
Hi everyone,

I am documenting one old project of mine and while doing it, I am going through the code and making bunch of optimization changes (wondering, when I finish, would it be worth anything? :)) Anyway, here is the situation [I'm using VFP6]: I have a form with lots of multiselect listboxes. All these listboxes have this.btcValArray as their rowsource. This array usually has two columns, the first is description and the second is a code. The number of rows in these arrays is ~10-20. I need to restore selections.

Here is the current piece of code, which does it:
for n = 1 to alen(.btcValArray, 1)	&& cycle over rows
   if at(.btcValArray[m.n, 2], m.list_arg)>0   && this item is to be selected
     .Container1.List1.selected(m.n) = .t. && flag list item as Selected
   endif
endfor
list_arg is a comma-delimited list of codes.

As you see, I'm looping through the array to set selected flag. This seems inefficient to me, if, say, I have only 2 items to mark as selected. There should be another way around... I'm wondering, if the optimization does make sense in this scenario and if yes, how would I optimize this code?


Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform