Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Randomly Moving Controls
Message
 
À
20/09/2000 15:38:45
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00418697
Message ID:
00418968
Vues:
28
MyContatiner.MyArray(15,3)
1 -[N] - .top
2 -[N] - .left
3 -[L] - assigned
MyContainer.Init

*!* Step Through the controls (if you have more controls than the buttons, you may need to alter this)
FOR lnObjCount = 1 TO THIS.ControlCount
  lnRow = INT(RAND(0)*15)  && randomly select row 
  DO WHILE THIS.MyArray(lnRow,3)
    *!*  since row has already been assigned, randomly select another row 
    lnRow = INT(RAND(0)*15)
  LOOP
  *!*  set properties for buttons
  THIS.Controls(lnObjCount).Top = THIS.MyArray(lnRow,1)
  THIS.Controls(lnObjCount).Left = THIS.MyArray(lnRow,2)
  THIS.MyArray(lnRow,3) = .T.
ENDFOR

THIS.Visible = .T.
THIS.Refresh
Bear in mind, that this is quite simple and the DO LOOP could potentially drag on when attempting to assign the last row or two.

You could also set up the coordinates in a table and assign an index key at run time. This would ensure that it would be quicker.

HTH
I try to stay online, to get better information.
I try to get away from the office once in a while..
But they KEEP... PULLING.. ME.. BACK.. IN!!!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform