Draggin a group

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Draggin a group

Post by maxs » Mon Dec 26, 2011 4:27 am

How do I drag a group in IOS?

on mousestilldown
set the loc of grp "Dragball1" of grp "3Balls" to the mouseloc


The release note mentions a touchMove id, x, y, but does not show examples, or explain how to send messages with it.

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Draggin a group

Post by Jellicle » Mon Dec 26, 2011 7:42 am

Try the "grab me" command in a mousedown handler n the group's script.

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Draggin a group

Post by jmburnod » Mon Dec 26, 2011 11:55 am

Hi Maxs

I have a script to drag an object. No tested for a group

Code: Select all

local sX,sY,canMove

-- For IOS
on touchstart
   put true into canMove
   put (the mouseH - item 1 of the loc of me) into sX
   put (the mousev - item 2 of the loc of me) into sY
end touchstart

on touchMove pTouchId,pX,pY
   if canMove then
      set loc of me to pX-sX,pY-sY
   end if
   put pX,pY
end touchMove

on touchend
 put false into canMove
end touchend

-- For desktop
--on mousedown
--   put true into canMove
--   put (the mouseH - item 1 of the loc of me) into sX
--   put (the mousev - item 2 of the loc of me) into sY
--end mousedown

--on mouseMove pX,pY
--   if canMove then
--      set loc of me to pX-sX,pY-sY
--   end if
--   put pX,pY
--end mouseMove
I hope this help

Best regards

Jean-Marc
https://alternatic.ch

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Draggin a group

Post by maxs » Mon Dec 26, 2011 8:24 pm

Thanks Jean-Marc,

THis will help. Sometimes the mousestilldown option seems to work in ios. Other times the objects dont move.

Thanks, Max

Post Reply