Why is this so difficult? (1 Viewer)

sznsx

Registered User.
Local time
Today, 12:11
Joined
Jul 25, 2004
Messages
20
I am trying to dynamically move objects on a form. For instance I have a button or image that I want to move over to the right when something else is clicked... As far as I know the answer has to do with the "Top" and "Left" property, but changing this value through code has no effect.
 

Nirious

Registered User.
Local time
Today, 19:11
Joined
Jul 31, 2004
Messages
106
sznsx said:
I am trying to dynamically move objects on a form. For instance I have a button or image that I want to move over to the right when something else is clicked... As far as I know the answer has to do with the "Top" and "Left" property, but changing this value through code has no effect.


have you tried refreshing or repainting the form?
 

sznsx

Registered User.
Local time
Today, 12:11
Joined
Jul 25, 2004
Messages
20
.....

For some reason now, whenever I change an objects top property the object moves to the very top of the form! How can this be so difficult? Shouldn't there be a place to define the X and Y coordinates on the grid?
 
M

Mike375

Guest
I don't know how you do it in code but this works with a macro SetValue

For Top

Item [Forms]![YourFormName]![ButtonName Text BoxName etc].Top

Expression 1440

1440 is 1440 twips and that equals 1 inch and 1 cm is 566.9 twips. So if you want the Top to be 1cm from the top then put 566.9 in the expression.

For height, width and left just do .Left etc instead of Top

With a macro there will be 4 SetValue actions, one after the other, so as to do top, left, height and width.

And don't forget that if you do left at say 1440 and the button or the field is in the middle of the screen it will appear to jump to the left by a few inches. Of course that happens because the 1440=1 inch is the distance from the left side of the form, not how far you moved the field or button to the left :)

Mike
 

Mile-O

Back once again...
Local time
Today, 17:11
Joined
Dec 10, 2002
Messages
11,316
Forget about macros. ;)



This example can handle itself should an attempt ever be made to move the control to a x, y position outwith the form's scope. A macro can't do that.
 

Attachments

  • dbMoveControl97.zip
    59.4 KB · Views: 120

Users who are viewing this thread

Top Bottom