Page 4 of 7

Re: Looking for Help on a Project

Posted: Tue Jun 20, 2017 11:58 pm
by bidgeeman
Than you Klaus.
Sorry for the mislaid original post. It's good to see you are still here after so many years :)
Bidge

Re: Looking for Help on a Project

Posted: Wed Jun 21, 2017 5:43 am
by bidgeeman
"SOLVED"
Can someone point me to the correct function to load an svg from one stack into a different widget from a button? I have been searching for hours going through threads but I can't find anything. Tried the code below with no luck.

Code: Select all

on mouseUp
set the iconPath of widget "SVG" to the iconPath of widget "Ribbon"
end mouseUp
Thanks
Bidge

Re: Looking for Help on a Project

Posted: Wed Jun 21, 2017 10:26 am
by richmond62
Just COPY-PASTE the widget from stack 1 to stack 2 . . . . .

Re: Looking for Help on a Project

Posted: Sun Jun 25, 2017 6:31 am
by bidgeeman
Hi .
I am loading images into a text field. I want the images to load in order of selection rather than have them replace a specific character as per this code I am using from the dictionary:

Code: Select all

on mouseUp
   set the imageSource of char 1 of line 1 of field "Numbers" to "Image.png" 
end mouseUp
How would I write this?

Thanks for any help once again.
Bidge

Re: Looking for Help on a Project

Posted: Sun Jun 25, 2017 8:31 am
by richmond62
Well, I suppose you would set up a loop and number the images sequentially
as they come in and then set each one to the character of the same number.

Re: Looking for Help on a Project

Posted: Mon Jun 26, 2017 1:33 pm
by bidgeeman
Is it possible to have a larger group follow another smaller group on a drag command?

Thanks
Bidge

Re: Looking for Help on a Project

Posted: Mon Jun 26, 2017 4:05 pm
by Klaus
Hi Bidge,
bidgeeman wrote:Is it possible to have a larger group follow another smaller group on a drag command?
yep, but will not work if using "... grab me ..."!

Put this into the script of your small group:

Code: Select all

local maydrag

on mousedown
   put TRUE into maydrag
end mousedown

on mouseup
   put false into maydrag
end mouseup

on mouserelease
   put false into maydrag
end mouserelease

on mousemove x,y
   if maydrag <> TRUE then
      exit mousemove
   end if
   set the loc of grp "the small one"  to x,y
   set the topleft of grp "the follower" to the topright of grp "the small one"
end mousemove
Tested and works! :D


Best

Klaus

Re: Looking for Help on a Project

Posted: Mon Jun 26, 2017 7:12 pm
by jmburnod
Hi Bidge,
Here is a stack which does the job using mousemove
Best regards
Jean-Marc

Re: Looking for Help on a Project

Posted: Mon Jun 26, 2017 7:39 pm
by Randy Hengst
I like Jean-Marc’s illustration… it provides quite a bit of flexibility. But, here is a super simple version that is much like Klaus’ script.

Place this script in the "leader group” -- "RedGroup" is the "follower group"

on mouseDown
grab me
end mouseDown

on mouseMove
set the loc of group "RedGroup" to the topRight of me
end mouseMove

This script also assumes that none of the controls contained in the group use mouseDown or mouseMove handlers. If you use a mouseDown in one of group controls, then make sure to pass it at the end of the handler.

randy

Re: Looking for Help on a Project

Posted: Mon Jun 26, 2017 9:52 pm
by jmburnod
Hi Randy,
Thanks for this.
I never used a grab command with mousemove message.
I believed mousemove doesn't work during a grab command :oops:

Re: Looking for Help on a Project

Posted: Mon Jun 26, 2017 10:28 pm
by Randy Hengst
The scipt has the advantage or disadvantage ... depending on your view … that the mouseMove handler acts a bit like a mouseEnter handler.

Assuming the two groups are not in their leading/following positions, when you move your mourse into the leading group, it following group will jump right into place… it will work like a mouseEnter handler. If the following group is already in its place, then you’ll not see the “jump."

Re: Looking for Help on a Project

Posted: Tue Jun 27, 2017 12:25 am
by bidgeeman
Thank you all Klaus, jmburnod and Randy.
Those examples are brilliant. Can someone explain why you can't set the large group to attach to the loc of the topCenter of the small group? I tried to adjust the script and it appears this property cannot be set???

Thank you all again
Bidge

Re: Looking for Help on a Project

Posted: Tue Jun 27, 2017 1:42 am
by Randy Hengst
You’re right, there is no topCenter, topMiddle etc.. to get that effect in my example you could change the mouseMove to this:

on mouseMove
lock screen
set the loc of group "RedGroup" to the loc of me
set the top of group "RedGroup" to the bottom of me
unlock screen
end mouseMove

Re: Looking for Help on a Project

Posted: Tue Jun 27, 2017 1:54 am
by bidgeeman
Randy that worked perfectly thank you :)
Regards
Bidge

Re: Looking for Help on a Project

Posted: Tue Jun 27, 2017 5:50 am
by bidgeeman
Hi "SOLVED" I had set the image layer to TOP
I have a problem and think it could be a bug? I have an image layer sitting over a few text fields.
Every time I load an image it jumps over to the top over the text fields? It doesn't appear to move in the project browser until I reload the project and then you can see it has elevated itself over the text fields.
Is there anyway to stop this?

Thanks again for your help
Cheers
Bidge