Drag&Drop of Pictures

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Drag&Drop of Pictures

Post by Tomka » Mon Mar 12, 2012 12:47 am

Hi,

I need little help. In my test-stack (see attachment) is a green bubble which is dragable. I need a way to see if its dropped into one of the three places on the right group.

But dragEnter dont work for that. If I drag the green bubble over the right group it doesnt beep. What my mistake?

Thanks alot
Attachments
test.zip
(42.43 KiB) Downloaded 237 times

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Drag&Drop of Pictures

Post by Mark » Mon Mar 12, 2012 1:47 pm

Hi,

If your picture stays within a window, then you don't need to to mess with drag actions. Just use a repeat loop. In its simplest form:

Code: Select all

on mouseDown
  repeat while the mouse is down with messages
    set the loc of me to the mouseLoc
    wait 0 millisecs with messages
  end repeat
  if the loc of me is within the rect of "Some Group" then
    // do something
  else if the loc of ms is wtihin the rect of "Other Group" then
    // do something else
  end if
end mouseDown
Kind regards,

Mark
Last edited by Mark on Mon Mar 12, 2012 2:35 pm, edited 1 time in total.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: Drag&Drop of Pictures

Post by Tomka » Mon Mar 12, 2012 2:11 pm

Thanks Mark. Sounds really good, I´ll check it out :)

Update´ll come soon.

Tomka
Posts: 59
Joined: Mon Apr 18, 2011 7:30 pm

Re: Drag&Drop of Pictures

Post by Tomka » Mon Mar 12, 2012 3:02 pm

Hi,

I see one little problem for my project in this script. Is it possible to dont use any groupnames in the script? The user can creat new groups which will be cloned. So it can happen that there are 20 or more groups with different names.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Drag&Drop of Pictures

Post by Mark » Mon Mar 12, 2012 3:10 pm

Hi,

Of course, you can add as many groups as you like. Just extend the script.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply