Appeller une fonction deux fois

cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011 - 21 août 2005 à 17:31
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011 - 6 sept. 2005 à 18:18
Bonjour J'ai un petit problème avec un prog que je suis entrain de faire.
J'utilise une fonction qui me sert à déplacer des images.
Cette fonction calcul la position a laquelle doit être déplacé l'image et la déplace à l'endroit approprié.

Cette fonction est appelée par le clic souris sur l'image concernée.
Donc si je clique sur l'image A, celle-ci se déplace de A1 en A2.
Donc tout va bien.

Mais si je veux déplacer deux images simultanément sa ne fonctionne plus.
Je clique sur l'image A. Son déplacement commence. Ensuite je clique sur l'image B. Et la le déplacement de A s'arrète et celui de B commence. B se déplace jusqu'en A2 (la ou aurait due aller l'image A) et pour finir A réaparait mais en B2.

Voila j'aurais voulu savoir si qqn savait d'ou pouvait venire se problème!!!!

16 réponses

pjcleder Messages postés 183 Date d'inscription jeudi 4 février 2010 Statut Membre Dernière intervention 16 septembre 2011 11
21 août 2005 à 17:34
PAT

D'emblée comme çà, on pourrait tenter le DoEvents qui permet de laisser le temps au système de faire ce qu'il a à faire.
Tu le mets en début de procédure.
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
21 août 2005 à 18:17
J'ai mis le doevents.
Si il ni été pas je ne pourrais pas cliquer sur la seconde image ;-)
0
cs_hassen Messages postés 338 Date d'inscription mardi 28 janvier 2003 Statut Membre Dernière intervention 4 novembre 2008
21 août 2005 à 18:30
peut etre c une question de variable public dans ta fonction

Hassen TUNISIE
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
21 août 2005 à 18:51
Comment ca variable public?

La fonction est une private sub c'est de sa que tu parles?
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_hassen Messages postés 338 Date d'inscription mardi 28 janvier 2003 Statut Membre Dernière intervention 4 novembre 2008
21 août 2005 à 19:10
est ce pourra ecrire le code de ton programme

Hassen TUNISIE
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
21 août 2005 à 19:24
Voici le code si tu as besoin de précision demande moi.

En gros la fonction regarde sur quelle image j'ai cliquer grace au indice2_imageX.
Puis une image 70 se met par dessus pour effectuer le déplcement.

Private Sub Déplacement_Plateau2()
Indice70 = Indice70 + 1
If Indice2_Image2 = 1 Then
Image70(Indice70).Left = Image2.Left
Image70(Indice70).Top = Image2.Top
Image70(Indice70).Visible = True
Image2.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image4 = 1 Then
Image70(Indice70).Left = Image4.Left
Image70(Indice70).Top = Image4.Top
Image70(Indice70).Visible = True
Image4.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image5 = 1 Then
Image70(Indice70).Left = Image5.Left
Image70(Indice70).Top = Image5.Top
Image70(Indice70).Visible = True
Image5.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image6 = 1 Then
Image70(Indice70).Left = Image6.Left
Image70(Indice70).Top = Image6.Top
Image70(Indice70).Visible = True
Image6.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image7 = 1 Then
Image70(Indice70).Left = Image7.Left
Image70(Indice70).Top = Image7.Top
Image70(Indice70).Visible = True
Image7.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image8 = 1 Then
Image70(Indice70).Left = Image8.Left
Image70(Indice70).Top = Image8.Top
Image70(Indice70).Visible = True
Image8.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image9 = 1 Then
Image70(Indice70).Left = Image9.Left
Image70(Indice70).Top = Image9.Top
Image70(Indice70).Visible = True
Image9.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image10 = 1 Then
Image70(Indice70).Left = Image10.Left
Image70(Indice70).Top = Image10.Top
Image70(Indice70).Visible = True
Image10.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image11 = 1 Then
Image70(Indice70).Left = Image11.Left
Image70(Indice70).Top = Image11.Top
Image70(Indice70).Visible = True
Image11.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image12 = 1 Then
Image70(Indice70).Left = Image12.Left
Image70(Indice70).Top = Image12.Top
Image70(Indice70).Visible = True
Image12.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image14 = 1 Then
Image70(Indice70).Left = Image14.Left
Image70(Indice70).Top = Image14.Top
Image70(Indice70).Visible = True
Image14.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image15 = 1 Then
Image70(Indice70).Left = Image15.Left
Image70(Indice70).Top = Image15.Top
Image70(Indice70).Visible = True
Image15.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image16 = 1 Then
Image70(Indice70).Left = Image16.Left
Image70(Indice70).Top = Image16.Top
Image70(Indice70).Visible = True
Image16.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image17 = 1 Then
Image70(Indice70).Left = Image17.Left
Image70(Indice70).Top = Image17.Top
Image70(Indice70).Visible = True
Image17.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image18 = 1 Then
Image70(Indice70).Left = Image18.Left
Image70(Indice70).Top = Image18.Top
Image70(Indice70).Visible = True
Image18.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image19 = 1 Then
Image70(Indice70).Left = Image19.Left
Image70(Indice70).Top = Image19.Top
Image70(Indice70).Visible = True
Image19.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image20 = 1 Then
Image70(Indice70).Left = Image20.Left
Image70(Indice70).Top = Image20.Top
Image70(Indice70).Visible = True
Image20.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image22 = 1 Then
Image70(Indice70).Left = Image22.Left
Image70(Indice70).Top = Image22.Top
Image70(Indice70).Visible = True
Image22.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image23 = 1 Then
Image70(Indice70).Left = Image23.Left
Image70(Indice70).Top = Image23.Top
Image70(Indice70).Visible = True
Image23.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image24 = 1 Then
Image70(Indice70).Left = Image24.Left
Image70(Indice70).Top = Image24.Top
Image70(Indice70).Visible = True
Image24.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image25 = 1 Then
Image70(Indice70).Left = Image25.Left
Image70(Indice70).Top = Image25.Top
Image70(Indice70).Visible = True
Image25.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image26 = 1 Then
Image70(Indice70).Left = Image26.Left
Image70(Indice70).Top = Image26.Top
Image70(Indice70).Visible = True
Image26.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image28 = 1 Then
Image70(Indice70).Left = Image28.Left
Image70(Indice70).Top = Image28.Top
Image70(Indice70).Visible = True
Image28.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image29 = 1 Then
Image70(Indice70).Left = Image29.Left
Image70(Indice70).Top = Image29.Top
Image70(Indice70).Visible = True
Image29.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image30 = 1 Then
Image70(Indice70).Left = Image30.Left
Image70(Indice70).Top = Image30.Top
Image70(Indice70).Visible = True
Image30.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
If Indice2_Image32 = 1 Then
Image70(Indice70).Left = Image32.Left
Image70(Indice70).Top = Image32.Top
Image70(Indice70).Visible = True
Image32.Visible = False
If Image70(Indice70).Top > Image69(Indice69) Then
Do While Image70(Indice70).Top > Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top - 5
Wait
Loop
End If
If Image70(Indice70).Top < Image69(Indice69).Top Then
Do While Image70(Indice70).Top < Image69(Indice69).Top
DoEvents
Image70(Indice70).Top = Image70(Indice70).Top + 5
Wait
Loop
End If
If Image70(Indice70).Left < Image69(Indice69).Left Then
Do While Image70(Indice70).Left < Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left + 5
Wait
Loop
End If
If Image70(Indice70).Left > Image69(Indice69).Left Then
Do While Image70(Indice70).Left > Image69(Indice69).Left
DoEvents
Image70(Indice70).Left = Image70(Indice70).Left - 5
Wait
Loop
End If
Image69(Indice69).Visible = True
Indice69 = Indice69 + 1
End If
Indice70 = Indice70 - 1
End Sub
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
22 août 2005 à 11:36
tu as indicé Image70 et Image69

je vois pas pourquoi tu n'as pas indicé Image2 à Image32 ainsi que les variables indice2

ce qui as obligé a répeter le même code 32 fois !!!!
désolé c'est pas de la programmation ça

de plus indice70 et indice69 ne sont pas locales et peuvent donc changer en cours de route.


Daniel
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
22 août 2005 à 21:37
Image2 à image32 n'ont pas été indicé lors de la création du prog.
La je suis entrain de rajouter des fonctions au prog donc plutot que de tous modifier j'ai préférer m'adapter a ce qui avait déjà été fait. Voila pourquoi les images 2 a 32 non pas été indicé.

De plus le code n'a pas été répété 32 fois mais 26 fois (je sais c'est beaucoup quand même)
indice69 et indice70 sont éffectivement déclaré en global. Ceci car je dois les appeler dans une fonction RAZ.
Mais cette fonction n'interfère pas avec le déroulemnt du prog (j'en suis sur).

Durant le fonctionnement, le seul endroit ou est modifié ces indices est cette fonction.

Donc voila, j'attend toujours votre aide ...
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
24 août 2005 à 10:59
Alors personne pour m'aider???
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
24 août 2005 à 13:47
c'est à cause de tes variables globales

faut les passer sur la pile.





Dim Indice As Integer

Dim Indice69 As Integer

Dim Indice70 As Integer



Private Sub Command1_Click()

Indice69 = Indice69 + 1

Indice70 = Indice70 + 1

Deplacement Indice69, Indice70, 1

Indice70 = Indice70 - 1

End Sub



Private Sub Command2_Click()

Indice69 = Indice69 + 1

Indice70 = Indice70 + 1

Deplacement Indice69, Indice70, 2

Indice70 = Indice70 - 1

End Sub



Private Sub Deplacement(ByVal Indice69%, ByVal Indice70%, ByVal Indice)



If Indice = 1 Then

Image70(Indice70).Left = Image2.Left

Image70(Indice70).Top = Image2.Top

Image70(Indice70).Visible = True

Image2.Visible = False



If Image70(Indice70).Top > Image69(Indice69).Top Then

Do While Image70(Indice70).Top > Image69(Indice69).Top

DoEvents


Image70(Indice70).Top = Image70(Indice70).Top - 1

wait

Loop

End If

If Image70(Indice70).Top < Image69(Indice69).Top Then

Do While Image70(Indice70).Top < Image69(Indice69).Top

DoEvents


Image70(Indice70).Top = Image70(Indice70).Top + 1

wait

Loop

End If

If Image70(Indice70).Left < Image69(Indice69).Left Then

Do While Image70(Indice70).Left < Image69(Indice69).Left

DoEvents


Image70(Indice70).Left = Image70(Indice70).Left + 1

wait

Loop

End If

If Image70(Indice70).Left > Image69(Indice69).Left Then

Do While Image70(Indice70).Left > Image69(Indice69).Left

DoEvents


Image70(Indice70).Left = Image70(Indice70).Left - 1

wait

Loop

End If

Image69(Indice69).Visible = True

End If



If Indice = 2 Then

Image70(Indice70).Left = Image4.Left

Image70(Indice70).Top = Image4.Top

Image70(Indice70).Visible = True

Image4.Visible = False

If Image70(Indice70).Top > Image69(Indice69).Top Then

Do While Image70(Indice70).Top > Image69(Indice69).Top

DoEvents


Image70(Indice70).Top = Image70(Indice70).Top - 1

wait

Loop

End If

If Image70(Indice70).Top < Image69(Indice69).Top Then

Do While Image70(Indice70).Top < Image69(Indice69).Top

DoEvents


Image70(Indice70).Top = Image70(Indice70).Top + 1

wait

Loop

End If

If Image70(Indice70).Left < Image69(Indice69).Left Then

Do While Image70(Indice70).Left < Image69(Indice69).Left

DoEvents


Image70(Indice70).Left = Image70(Indice70).Left + 1

wait

Loop

End If

If Image70(Indice70).Left > Image69(Indice69).Left Then

Do While Image70(Indice70).Left > Image69(Indice69).Left

DoEvents


Image70(Indice70).Left = Image70(Indice70).Left - 1

wait

Loop

End If

Image69(Indice69).Visible = True

End If



End Sub


Daniel
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
6 sept. 2005 à 15:13
Oui Daniel de cette manière les billes vont au bon endroit . Merci
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
6 sept. 2005 à 16:04
Par contre les billes ne se déplacent toujours pas simultanément.

J'ai pourtant mis des doevents dans les boucles.

C'est la dernière billes sur laquelle j'ai cliqué qui se déplace, puis l'avant dernière, etc jusqu'à la première.
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
6 sept. 2005 à 16:24
normal puisque les boucles sont faites séquentiellement et non pas simultanément.

quand je dis simultanément c'est pas vraiment vrai puisqu'une seule instruction peut se faire en même temps.

ce qu'il faudrait faire c'est les bouger l'une après l'autre de pixel en pixel.

mais la méthode ici va être très lourde.

indice doit être testé au niveau le plus bas donc doit être indexé aussi.



principe:

mettre un Timer, c'est lui qui fera bouger les billes, par exemple 1 pixel tous les 100 millisecondes.

une table qui donne les billes qui doivent bouger et la position de fin.

dsans le timer, on parcourt la table, si bille doit bouger, on fait
bouger la bille d'un pixel, si la fin est atteinte on remet la table à
zéro.

en bougeant seulement d'un pixel, on aura l'impression que toutes les billes bougent en même temps.

d'où l'intérêt d'avoir des contrôles indicés et des tables correspondantes.




Daniel
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
6 sept. 2005 à 16:31
Mais je pensais qu'en mettant des doevents sa marcheré.

On éxécuté la première boucle jusqu'au doevents puis on éxecute l'autre boucle puis a nouveau la première, puis a nouveau l'autre, etc

Ni y'a t'il pa moyen de faire cela?
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
6 sept. 2005 à 17:59
non pas du tout, c'est pas de la multi.

le DoEvents va permettre à windows de traiter ses messages, par exemple
Click sur un Bouton, ton programme s'arrête, les données locales sont
mises sur la pile, l'évênement s'effectue jusqu'au bout (si pas d'autre
évênement), donc ici c'est la dernière image cliquée qui va se déplacer
jusqu'au bout, ensuite les données sont reprises de la pile, et la
première image reprend où elle en était.
si les variables sont
globales, elles sont pas mises sur la pile, et la première image repart
avec des données qui ont été modifiées.



Vb6 c'est un seul thread, un seul programme tourne en même temps.

il n'y a pas d'alternance, pas de découpage de traitement.

le Timer est la seule solution valable, et c'est à toi de le gérer.


Daniel
0
cs_snake57 Messages postés 204 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 1 novembre 2011
6 sept. 2005 à 18:18
Bon ben j'essaierai de gérer sa dans un timer.

Merci pour ton aide
0
Rejoignez-nous