Moving an object on a screen

Discuss issues and ideas you have to configuring displays with PowerVision
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Moving an object on a screen

Post by drphil69 » Mon Feb 06, 2017 3:21 pm

Thank you for your reply. I started a new topic since I wasn't getting any follow up...

Can you explain what each line does? I don't want to end up with the object moving around the screen, I want to be able to place it. I will have a variable, YPosition, coming in over CAN, and when it changes I want to move the object to the new position. How do I reference the incoming data variable? Are all those lines required to change the Y position of an object?

void $ScreenMoveAction$ ()
{


ScreenPositionData scr;
scr.ObjectID = ScreenObjectIDs.Ellipse_Widget;
scr.Recurrance = 20;
scr.AnimationType = AnimationTypes.FastInAccelerator;
scr.AnimationFactor = 3;
scr.EventId = EventIDs.ScreenRotateAction;
scr.XValue = 450.0f;
scr.YValue = 123.0f;

SendActionObject( ApplicationIDs.Screen , ActionIDs.Screen_AnimatePosition , @scr);
SendAction( ApplicationIDs.Screen , ActionIDs.Screen_Process, ActionData.Empty );

I think it might be easier using the state machine since I am only changing the y position.

Can you explain how to use Screen Application/Move in state machines?

It says "Move an object to location using MovePosX/MovePosY variables. Requires process."

Thanks,
Phil
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: Moving an object on a screen

Post by boyce » Mon Feb 06, 2017 3:40 pm

I was waiting on an example of animation using a state machine but the one I got seemed too complicated. So I'll just give you the actions to move an object.

In a state it really only needs 2 actions:

Screen->AnimatePosition(SCR_OBJ, 155, 135, 25 steps)
Screen->Process((Empty))

In the Screen->AnimatePosition select the Screen Object (SCR_OBJ for example) and the X and Y Expressions (just the X and Y coordinates in this example).
Screen->Process is the Requires process statement that you mentioned.
animateposition.JPG
animateposition.JPG (77.7 KiB) Viewed 82 times
Hope this helps.
Boyce Schrack
Enovation Controls
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Re: Moving an object on a screen

Post by drphil69 » Mon Feb 06, 2017 4:12 pm

Ok, I see what I was doing wrong. I thought I could use the "Move" command, but that apparently doesn't do what I want.

I used the animate in state machines and it all works perfectly!

Thank you!

Phil