Re: Placing a picture or graphic object

2018-11-12 Thread Chip Scheide via 4D_Tech
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 +, 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:4d_tech-unsubscr...@lists.4d.com
> **
---
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Placing a picture or graphic object

2018-11-12 Thread Peter Mew via 4D_Tech
Thanks
I hadnt appreciated the different syntax between the absolute and relative
modes
cheers
-pm

On Sun, Nov 11, 2018 at 8:56 PM Jeremy French  wrote:

> Hi Peter,
>
> Ok, so the line is 1px wide and 60px high. You want to keep the line's
> dimensions but relocate the line to top = 0, left =55.
>
> Use absolute coordinates (which occur when the asterisk parameter is
> present.)
>
> Specify the top left coordinates as (x=55, y=0)
> Specify the bottom right coordinates (x=55, y=60)
>
> So you end up with this call:
>
> MOVE OBJECT(*;”<>Cursor2”;55;0;55;60;*)
>
> Regards,
> Jeremy French
>
> On Nov 11, 2018, at 2:56 PM, Peter Mew via 4D_Tech <4d_tech@lists.4d.com>
> wrote:
>
> 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
>
>
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Placing a picture or graphic object

2018-11-11 Thread Jeremy French via 4D_Tech
Hi Peter,

Ok, so the line is 1px wide and 60px high. You want to keep the line's 
dimensions but relocate the line to top = 0, left =55.

Use absolute coordinates (which occur when the asterisk parameter is present.)

Specify the top left coordinates as (x=55, y=0)
Specify the bottom right coordinates (x=55, y=60)

So you end up with this call:

MOVE OBJECT(*;”<>Cursor2”;55;0;55;60;*)

Regards,
Jeremy French

> On Nov 11, 2018, at 2:56 PM, Peter Mew via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> 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

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Placing a picture or graphic object

2018-11-11 Thread Peter Mew via 4D_Tech
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:4d_tech-unsubscr...@lists.4d.com
**