How do I move an object on screen using programming?

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

How do I move an object on screen using programming?

Post by drphil69 » Thu Feb 02, 2017 11:38 am

Hello,

I need to change the Y position of a screen object depending on a variable received over CAN. How do I do this?

Specifically, I created a container which encompasses a line and text, and set "Include in Programming = True." This line and text will move up and down a bar gauge depending on a variable received over CAN. The variable will be the actual Y position where I want the text and line to be located. The X position will not change.

So all I need to know is how to set the Y position of the container to the value received via CAN message.

I am using PV 2.8.10491.

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

Re: How do I move an object on screen using programming?

Post by boyce » Thu Feb 02, 2017 2:58 pm

Here is a link to a page that has some example configurations. The one Test Scripting Animation shows how objects can be moved.

viewtopic.php?f=26&t=872
Boyce Schrack
Enovation Controls
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Re: How do I move an object on screen using programming?

Post by drphil69 » Thu Feb 02, 2017 5:08 pm

Thank you for your reply.

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 );
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Re: How do I move an object on screen using programming?

Post by drphil69 » Thu Feb 02, 2017 5:19 pm

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
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Re: How do I move an object on screen using programming?

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

Ugh... I guess I have to start a new thread to get an answer.
drphil69
Posts: 139
Joined: Wed Mar 02, 2011 5:59 pm

Re: How do I move an object on screen using programming?

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

Ugh... I guess I have to start a new thread to get an answer.