Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Randomly Moving Controls
Message
 
To
21/09/2000 14:16:18
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00418697
Message ID:
00419225
Views:
33
>Matt,
>
>I have my container shuffleing the controls. Now the container is a 4 x 4 and has 15 controls in it which leaves a space empty. I am tring to get the code right that will move a control into the empty space when clicked only if the button is adjacent to the empty space. I am having trouble testing for a button residing to the left, top, bottom, right of a clicked button.

Steven,

You have to think outside the box. He's my stab.. but don't forget, there are dozens of ways to skin a cat..

Each position for a button should have an address: 1 through 16. Create a validation lookup table:
Btn_Address N(2), Valid_near N(2)
1,2
1,5
2,1
2,3
2,6
3,2
3,7
etc.....

Each button should have a position property. (HINT: create a new button class) Each time a button gets moved, the position property should be updated. Prior to moving a button, valididate the destination by doing a seek:
SELECT Add_Valid
SET ORDER TO Adr_Validate  &&  [Btn_Address*100+Valid_near]

lnCurrent = 5
lnTarget = 6

IF SEEK(lnCurrent*100+lnTarget)

  * button move code here (use the array as stated in the previous post)

ENDIF
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!!!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform