Move
PowerScript function
Description
Moves a control or object to another position relative to its parent
window, or for some window objects, relative to the screen.
Applies to
Any object or control
Syntax
|
1 |
objectname.Move ( x, y ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the object or control you want to move to a |
|
x |
The x coordinate of the new location in PowerBuilder |
|
y |
The y coordinate of the new location in PowerBuilder |
Return value
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.
Usage
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. For a
line control, x and y are the BeginX and BeginY properties.
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 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.
Equivalent syntax
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 PowerBuilder to redraw objectname twice, first at the new
location of X and then at the new X and Y location:
|
1 2 |
objectname.X = x objectname.Y = y |
These statements cause PowerBuilder to redraw gb_box1 twice:
|
1 2 |
gb_box1.X = 150 gb_box1.Y = 200 |
This statement has the same result but redraws gb_box1 once:
|
1 |
gb_box1.Move(150,200) |
Examples
This statement changes the X and Y properties of gb_box1 to 150 and
200, respectively, and moves gb_box1 to the new location:
|
1 |
gb_box1.Move(150, 200) |
This statement moves the picture p_Train2 next to the picture
p_Train1:
|
1 2 |
P_Train2.Move(P_Train1.X + P_Train1.Width, & P_Train1.Y) |