Page 2 of 2

Re: Aligning the edge of an image

Posted: Tue Jul 11, 2017 8:08 pm
by bogs
richmond62 wrote:
Flexibility often needs complexity...
C'est possible, mais Je cherche chaque chance pour une méthode trop simple,
mais Je suis paresseux :D
Translation Google wrote:It is possible, but I seek every chance for a method too simple,
But I'm lazy: D
Ok, the french gave me flash-backs to high school, which (temporarily) made me more unstable than I already am mentally, so I took the lazy way out and google'd it :P

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 12:54 am
by bidgeeman
Well I must agree with you completely being a beginner :)
Thank you again.
Bidge

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 2:34 am
by bidgeeman
Hello again.
I have studied your script and attempted to add a forth
image to the group. I managed to do it but for some reason
I have to click twice before the forth image goes into place?
Can someone have a look to see what I have done wrong?

Ideally I would like to add up to 6 images across the top and 6 images
below that can all be adjusted with two margin factor? if possible?
Maybe there is an easier way?

Thanks
Bidge

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 4:38 am
by bidgeeman
Well...after a lot of searching I managed to come up with a rather simple solution :)

Code: Select all

on mouseUp
   set the top of img "W2" to the top of img "W1"
   set the left of img "W2" to (the right of img "W1") + 10
      set the top of img "W3" to the top of img "W2"
      set the left of img "W3" to (the right of img "W2") + 10
      
      set the left of img "W4" to the left of img "W1"
      set the top of img "W4" to (the bottom of img "W1") + 10
      
            set the left of img "W5" to the left of img "W2"
            set the top of img "W5" to (the bottom of img "W2") + 10
            
                        set the left of img "W6" to the left of img "W3"
      set the top of img "W6" to (the bottom of img "W3") + 10
   
end mouseUp
Cheers
Bidge

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 9:01 am
by jmburnod
Hi Bidge,
attempted to add a forth image to the group
There is no group in your stack and mousedown in cd script is not called because each img catch it
Maybe there is an easier way?
If you want move all controls of a group you maybe could move group instead controls of group

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 9:06 am
by bidgeeman
Thank you Jean-Marc.
I managed to get the result without using a group with your help.
Saving a text file that sets the locations, width etc of each image
is now my next hurdle: ( I posted in another thread earlier).
http://forums.livecode.com/viewtopic.php?f=7&t=29485

Cheers
Bidge

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 10:14 am
by jmburnod
I made your script more flexible but more... complicated :D
Who is the laziest ? 8)

Code: Select all

on mouseUp
   doAlignImg 2,3,10,10 --pNbRow,pNbCol,pMargeH,pMargeV
end mouseUp

on doAlignImg pNbRow,pNbCol,pMargeH,pMargeV
   put the height of img "W1" into tHeight
   put tTlC into depTR
   put pNbRow * pNbCol into tNbTot
   put 10,10 into depTR
   repeat with i = 1 to tNbTot
      put "W" & i into tImg
      set the topleft of img tImg to depTR
      put the topright of img tImg into depTR
      add pMargeH to item 1 of depTR
      put i mod pNbCol into tReste
      if tReste = 0  then
         put 10 into item 1 of  depTR
         add (tHeight + pMargeV) to item 2 of depTR
         next repeat
      end if
      wait 1 milliseconds
   end repeat
end doAlignImg

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 10:20 am
by Klaus
Hi David,

when in the script editor, hit TAB from time to time, then you will get these nice indented scripts like the ones from Jean-Marc!
AND we can read them better. :D


Best

Klaus

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 10:21 am
by bidgeeman
Wow. It astounds me how you can think of such clever ways coding Jean - Marc!!! :shock:
Oh....thank you Klaus :)

Regards
Bidge

Re: Aligning the edge of an image

Posted: Wed Jul 12, 2017 10:31 am
by jmburnod
Thanks for the flowers.
I confess a big debt to some mentors of this forum :roll: