Move control/object at run-time

How to move any object Run Time

example

i have create one window
add three text control
& run it
after run i have to change possition the text object with mouse.

any one can do this task.

from
Tushar

Hi Tushar,

Check this thread from the old forum: http://forums.realsoftware.com/viewtopic.php?f=1&t=42036

Julen

Julien beat me to a response, but if you want to see something very very quick and dirty, this code will turn a text box into a draggable one and back again, by clicking on it.

Click once to start moving, click again to stop.

Add a class to your project.
Name it DraggableTextField
Set the Class to inherit from TextField.

Add these properties:

Dragging as boolean Startx as integer starry as integer

Add this to the MouseDown event:

startx= x starty = y dragging = not dragging return true

add this to the mouse move event:

if dragging then me.left = me.left + x-startx me.top = me.top + y-starty end if

add this to the mouse exit event (to handle loss of mouse due to rapid movement

dragging = false

Finally, add a text field to a window.
Change its super to DraggableTextField
Run and test.