in reply to Re: Canvas group members syntax
in thread Canvas group members syntax
I then used the following subroutines (which I found on another Monks thread) to select the items that had the tag, ‘jump’them onto the cursor and move them to the required position.$wg{Layout_Canvas}->bind($last_tag_global, '<1>', sub {&mobileStart(); +}); $wg{Layout_Canvas}->bind($last_tag_global, '<B1-Motion>', sub {&mobile +Move();}); $wg{Layout_Canvas}->bind($last_tag_global, '<ButtonRelease-1>', sub {& +mobileStop();});
This nearly worked except that it would only move one of the items at a time and onlywhen the cursor was exactly or nearly exactly over a section (for example a side of a rectangle drawn with canvasRectangle) of the item. What do I have to do so that I can select all of the items that have a particular tag (by placing the cursor somewhere in the 'middle' of the items that have the tag)and move them together to where I want them to be?sub mobileStart { my $ev = $wg{Layout_Canvas}->XEvent; ($dx_cursor, $dy_cursor) = (0 - $ev->x, 0 - $ev->y); $wg{Layout_Canvas}->raise('current'); print "START MOVE-> $dx_cursor $dy_cursor\n"; } sub mobileMove { my $ev = $wg{Layout_Canvas}->XEvent; $wg{Layout_Canvas}->move('current', $ev->x + $dx_cursor, $ev->y ++$dy_cursor); ($dx_cursor, $dy_cursor) = (0 - $ev->x, 0 - $ev->y); print "MOVING-> $dx_cursor $dy_cursor\n"; } sub mobileStop{&mobileMove;}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Canvas group members syntax
by merrymonk (Hermit) on Jun 03, 2008 at 16:38 UTC | |
|
Re^3: Canvas group members syntax
by zentara (Cardinal) on Jun 03, 2008 at 17:18 UTC |