Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Select next item in Mover Class
Message
De
06/01/2005 15:07:24
 
 
À
06/01/2005 13:50:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00974692
Message ID:
00974812
Vues:
28
>>>>>>In mover class after moving one item from source list box to selected list box I would like to select the next item of source list box automatically.
>>>>>>
>>>>>>I have tryed Click and setfocus method. What it works is to set the value property with the next value of item, but how to find out the next value?
>>>>>
>>>>>
>>>>>What If:
>>>>>
>>>>>IF thisform.MoverList.ListIndex < thisform.MoverList.ListCount
>>>>>   thisform.MoverList.ListIndex = thisform.MoverList.ListIndex+1
>>>>>ELSE
>>>>>   thisform.MoverList.ListIndex = 1
>>>>>ENDIF
>>>>>
>>>>
>>>>Simplified:
>>>>
>>>>thisform.MoverList.ListIndex = (thisform.MoverList.ListIndex+1) % thisform.MoverList.ListCount + 1
>>>>
>>>
>>>hi Fabio,
>>>
>>>I take it that you meant
>>>
>>>thisform.MoverList.ListIndex = (thisform.MoverList.ListIndex+1) % (thisform.MoverList.ListCount + 1)
>>>
>>>
>>>But either way, it will fail
>>
>>Sorry, I do not understand, why you have written this?
>>Fabio
>
>
>
>ListIndex = 4
>ListCount = 10
>>>>thisform.MoverList.ListIndex = (thisform.MoverList.ListIndex+1) % thisform.MoverList.ListCount + 1
>Result: (4+1) % 10 + 1 = 6  && increment by 2, precedence of % is higher than +
>
>
>
>
>ListIndex = 4
>ListCount = 10
>thisform.MoverList.ListIndex = (thisform.MoverList.ListIndex+1) % (thisform.MoverList.ListCount + 1)
>Result: (4+1) % (10 + 1) = 5 && goes one up
>
>Problem:
>ListIndex = 10
>ListCount = 10
>Result: (10+1) % (10 + 1) = 0
>>>
>
>
>Update:
>
>Correct is
>
>thisform.MoverList.ListIndex = thisform.MoverList.ListIndex % thisform.MoverList.ListCount + 1
>
Right. Written without to think.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform