Moves a control or object to another position relative to its parent window, or for some window objects, relative to the screen.
Any object or control
objectname.Move ( x, y )
Argument |
Description |
---|---|
objectname |
The name of the object or control you want to move to a new location |
x |
The x coordinate of the new location in PowerBuilder units |
y |
The y coordinate of the new location in PowerBuilder units |
Integer. Returns 1 if it succeeds and -1 if an error occurs or if objectname is a maximized window. If any argument’s value is null, Move returns null.
The x and y coordinates you specify are the new coordinates of the upper-left corner of the object or control. If the shape of the object or control is not rectangular (such as, a RadioButton or Oval), x and y are the coordinates of the upper-left corner of the box enclosing it.
When you move controls, drawing objects, and child windows, the coordinates you specify are relative to the upper-left corner of the parent window. When you use Move to position main, pop-up, and response windows, the coordinates you specify are relative to the upper-left corner of the display screen.
Move does not move a maximized sheet or window. If the window is maximized, Move returns –1.
You can use Move to move a line control but the results are unpredictable because the line has multiple x and y coordinates.
You can specify coordinates outside the frame of the parent window or screen, which effectively makes the object or control invisible.
To draw the image of a Picture control at a particular position, without actually moving the control, use the Draw function.
The Move function changes the X and Y properties of the moved object.
The syntax below directly sets the X and Y properties of an object or control. Although the result is equivalent to using the Move function, it causes PocketBuilder to redraw objectname twice, first at the new location of X and then at the new X and Y location:
objectname.X = x
objectname.Y = y
These statements cause PocketBuilder to redraw gb_box1 twice:
gb_box1.X = 150
gb_box1.Y = 200
This statement has the same result but redraws gb_box1 once:
gb_box1.Move(150,200)
This statement changes the X and Y properties of gb_box1 to 150 and 200, respectively, and moves gb_box1 to the new location:
gb_box1.Move(150, 200)
This statement moves the picture p_Train2 next to the picture p_Train1:
P_Train2.Move(P_Train1.X + P_Train1.Width, &
P_Train1.Y)