Problem with drag/drop of a group

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
melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

Problem with drag/drop of a group

Post by melristau » Wed Aug 10, 2016 1:55 am

Working on a custom translucent palette (with implied capability of repositioning by dragging from the top region) and not having success with use of grab/mouseMove technique... Have posted the small test stack for detailed exam. Again, I need the drag/drop capability of a palleted stack but can't achieve the translucency needed with a substack.

https://www.dropbox.com/s/5myhf93ce4dci ... ecode?dl=0

Any pointers greatly appreciated.
Attachments
translucentPalette.jpg
rebuilding visual programming app originally created in 1993 as Hypercard stack

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with drag/drop of a group

Post by Klaus » Wed Aug 10, 2016 11:32 am

Hi Mel,

OK, I downbloaded the stack but have no idea what should happen and when?
No "grab/mousemove" handler in the stack!?
..but can't achieve the translucency needed with a substack.
Doiu you mean setting "the blendlevel" of that stack?


Best

Klaus

melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

Re: Problem with drag/drop of a group

Post by melristau » Wed Aug 10, 2016 4:22 pm

My apology Klaus. I removed the mousedown mousemove handlers. Just looking for a pointer (have looked myself!) to scripting related to dragging a control from top (in case posted, green bar area only). ...Behavior like a standard paletted stack.
rebuilding visual programming app originally created in 1993 as Hypercard stack

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with drag/drop of a group

Post by Klaus » Wed Aug 10, 2016 4:39 pm

Hi Mel,

I added this little snippet to the groups script and it worked as exspected.
I had to add the name of the group, otherwise I got a "could not find background" error.

Code: Select all

on mousedown
   if the short name of the target = "ioMap" then
      grab grp "ioMap"
   end if
end mousedown
Is that what you mean?


Best

Klaus

melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

Re: Problem with drag/drop of a group

Post by melristau » Wed Aug 10, 2016 5:43 pm

Thanks Klaus
After a cup of coffee I believe I have a solution:

https://www.dropbox.com/s/es1oo24gat2ci ... ecode?dl=0

not sure how foolproof it is but...
rebuilding visual programming app originally created in 1993 as Hypercard stack

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with drag/drop of a group

Post by Klaus » Wed Aug 10, 2016 6:12 pm

Hi Mel,

I modified your script a bit ansd still works a exspected:

Code: Select all

...
on mouseDown
   if the short name of the target is "dragMap" then

      ## grab the target
      ## Will only move the text field named "dragMap"
      grab group "ioMap"
   end if
end mouseDown

## Not neccessary!
#on mouseMove
#   if the mouse is down then    
#      if the short name of the target is "dragMap" then
#         put ((item 1 of the loc of the target)+16)&","&((item 2 of the loc of the target)+105) into locAdjustment
#         set the loc of group "ioMap" to locAdjustment
#      end if
#   end if
#end mouseMove
...
The "mousemove" handler is a bit overkill, no need to adjust the loc in any way, looks like a correct "mousedown" handler is enough. :D


Best

Klaus

melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

Re: Problem with drag/drop of a group

Post by melristau » Thu Aug 11, 2016 2:04 am

That's really simple! Good to learn. Thanks again Klaus.
rebuilding visual programming app originally created in 1993 as Hypercard stack

Post Reply