Page 1 of 1

Problem with drag/drop of a group

Posted: Wed Aug 10, 2016 1:55 am
by melristau
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.

Re: Problem with drag/drop of a group

Posted: Wed Aug 10, 2016 11:32 am
by Klaus
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

Re: Problem with drag/drop of a group

Posted: Wed Aug 10, 2016 4:22 pm
by melristau
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.

Re: Problem with drag/drop of a group

Posted: Wed Aug 10, 2016 4:39 pm
by Klaus
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

Re: Problem with drag/drop of a group

Posted: Wed Aug 10, 2016 5:43 pm
by melristau
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...

Re: Problem with drag/drop of a group

Posted: Wed Aug 10, 2016 6:12 pm
by Klaus
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

Re: Problem with drag/drop of a group

Posted: Thu Aug 11, 2016 2:04 am
by melristau
That's really simple! Good to learn. Thanks again Klaus.