Peter,
here is code I use for moving things. it simplifies the whole process 
for me. I no longer have to remember exact syntax etc. 
Note you can use a pointer to a n active object (button, variable etc), 
or pass Nil as $1 and the object name in $4 for static objects (text, 
etc)

  //Project Method:  utl_Move_Object
  //$1 - Pointer - to object to move - if Nil, use object name passed 
in $4
  //$2 - Longint - absolute left location to place object
  //$3 - Longint - absolute top location to place object
  //$4 - Text (optional) - Object Name, only used if Nil pointer passed 
in $1

  //move an object to it's absolute left and top (supplied) position
  // ∙ Created 10/17/12 by Chip - 
C_POINTER($1;$Object_ptr)
C_LONGINT($2;$3;$New_Top;$New_Left;$Top;$Bottom;$Left;$Right)
C_TEXT($4;$Object_Name)

$Object_ptr:=$1

If (Nil($Object_Ptr))
$Object_Name:=$4
$Object_ptr:=OBJECT Get pointer(Object named;$Object_Name)
End if 
$New_Left:=$2
$New_Top:=$3

If (Not(Nil($Object_ptr)))
OBJECT GET COORDINATES($Object_ptr->;$Left;$Top;$Right;$Bottom)

$Right:=$Right+($New_Left-$Left)
$Bottom:=$Bottom+($New_Top-$Top)
OBJECT MOVE($Object_ptr->;$New_Left;$New_Top;$Right;$Bottom;*)
Else   //object to be moved is a text or other object which can't be 
referenced via pointer
OBJECT GET COORDINATES(*;$Object_Name;$Left;$Top;$Right;$Bottom)

$Right:=$Right+($New_Left-$Left)
$Bottom:=$Bottom+($New_Top-$Top)
OBJECT MOVE(*;$Object_Name;$New_Left;$New_Top;$Right;$Bottom;*)
End if 
  //End utl_Move_Object




On Sun, 11 Nov 2018 19:56:41 +0000, Peter Mew via 4D_Tech wrote:
> Hi
> I am creating a graphic  object, could be a line or rectangle or a picture.
> Having created it, how do I place it on the form where I Want it.
> Bear in mind Im on v13 and dont have access to object set coordinates, only
> move picture, transform picture, and object get coordinates.
> Object Move, using absolute coordinates, doesnt seem to work
> For Example I want to place a Grapic called "Cursor" at absolute
> coordinates ^0 pixels from the top of the form, and 55 pixels from the left
> edge of the form, no resizing.
> so I call
> $CursorPosPix:=55
> OBJECT MOVE(*;"<>Cursor2";$CursorPosPix;60;0;0;*)
> <>Cursor2 is a Vertical Line 1 pixel in width and 60 pixels high
> The result is a diagonal line starting at 0 pixels on the form and
> finishing at 60 pixels from the top and about 600 pixels from the left edge.
> Thanks
> -pm
> Mac Yosemite
> 4D v13.6
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to