Today I'm going to create a set of objects that allow you to control the position of another object. In essence, I am going to make 4 objects that will act as up, down, left, and right and then the cursor object that will be what is being controlled by the others.
Step 1: Create the first object.
Step 2: Go to its properties.
Step 3: Change its image to be an arrow.
Step 4: Create the target object and give it an image too.
Step 5: Give this object a name.
Step 6: Go back to your original object and create new script for it.
Step 7: Using the scripting guide located here: https://www.stardock.com/products/desktopx/docs/3x/DXScripting.doc have this object take over the mouse button down message.
You will find that the what you want to add is something like this:
|Function Object_OnLButtonDown(x, y)|
DesktopX.Object("TargetObject").bottom = DesktopX.Object("TargetObject").bottom - 10
Step 8: Clone your control object 3 more times and make a couple tweaks so that they are down, left and right buttons.
For example, I want to use the same up arrow graphic but I need it to point right. So I rotate it 90 degrees. For the down one I would rotate it 180 degrees and the one pointing left I would rotate is 270 degrees..
Object.Rotation = 90
Then I change what is being done to the target object based on which button. For example, the button moving it to the right would have this code:
And voila. There you go. I'll now export it and upload it for yourself. If you have DesktopX Pro, you could export it as a stand-alone program to send to anyone whether they have DesktopX or not.
Download sample here.