News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Using callbacks to move objects on the screen
Author Message
widged
Junior Member
**


Posts: 35
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: Using callbacks to move objects on the screen

Thanks Bill, that's spiffy stuff! Bill provided me with the code (from mikshaw, I assume), I only had to modify a few lines.

It can be useful to know that thing = the crosshair widget.

To see it, change 50 to another color in thing:selection_color(50).

It's a hacked drag and drop, so it doesn't really work like a standard drag and drop. What you need to do is first click on the object you want to drag. Then you have to click again on the object to move it around (to the user, it looks like they drag the object when what they do, in reality, is drag the center of the crosshair, with a callback that resets the position of the square).

Note that the maths are slightly inexact and don't take into account the left and right margins (causing the square to appear slightly offset when on the extreme left or right sides of the screen).

Feel free to suggest ways to improve the code. In particular, there shouldn't be the need for two square_cb functions... I don't have time to do better today.

This post was last modified: 06-02-2007 03:45 AM by widged.

06-02-2007 03:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: Using callbacks to move objects on the screen - widged - 06-02-2007 03:44 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: