Simplicty and flexibility!


MoveObject


Started by afonso santos
Search
You will need to Sign In to be able to add or comment on the forum!

MoveObject

Hi all,

I've a field XSIZE with a derivation getcurrent ("width") and a YSIZE field with a derivation getcurrent ("height"), both defined as virtual fields

In a manip virtual field I've the instruction as follows :

MoveObject ("bt_111" ,XSIZE-getcurrent("Width","bt_111") -10, YSIZE- getcurrent("height","bt_111" )-5)

bt_111 is the object name ( a button )

XSIZE-getcurrent("Width","bt_111") -10 is working

but 

YSIZE- getcurrent("height","bt_111" )-5 is not

The result is a wrong  v Position

What am I doing wrong?

Tks



Written by afonso santos 10/03/18 at 18:45:13 Dataease [{8}]FIVE

Re:MoveObject


Hi Afonso.

Nice to see that you play with these features.

1. It looks like you want to move the button to the lower right corner and there is a easier and better way to do that.

MoveObject("bt_111","R","B")+MoveObject("bt_111","-10","-5") 

This will move the button to the bottom right corner and then back 10 px in X direction and 5 px in Y direction.

However, your way should work to and it will.

The problem you stuggle with is text number conversion.

I got the same problem as you but it was my X direction that didn't work.

You see that the X number her contain a , as thousand separator. This is a visual "aid" from windows but you can't type numbers into derivations in DataEase like that as we don't use thousand seperators so the number is "invalid" i.e. 0.

So my fix was to replace the , with "".

MoveObject ("bt_111" ,StringReplace(getcurrent("Width")-getcurrent("Width","bt_111") -10,",",""), getcurrent("Height")-getcurrent("Height","bt_111" )-5)

But again, the method above is much easier if you want to place stuff relative to the edges.

MoveObject has three modes.

1. Move relative to edges i.e. X= L,C,R and Y=T,C,B i.e MoveObject("MyObject","C","C") which will move it to the center of the screen.
2. Move relative to current position i.e +10 -100 i.e MoveObject("MyObject","-10","-10") .
3. Absolute position i.e MoveObject("MyObject","100","100")

The arguments are all string. If you want to retain a value you can't leave it blank as that will be read as 0 so you need to use +0 relative (or -0 ;-).


Written by DataEase 11/03/18 at 11:05:39 Dataease [{8}]FIVE
DG3_ForumList