Page 1 of 1

Group Locations

Posted: Sun Dec 12, 2010 8:55 pm
by bsouthuk
Hi Guys

I have been banging my head against the wall over the last couple of days trying to work out a way of placing groups so that they are aligned and placed on above each other with no overlap.

Is there a short script I can use so that if i click a button that all groups that are visible on a card are placed neatly aligned to the left and directly above each other?

You help would be most appreciated!

Thanks


Daniel

Re: Group Locations

Posted: Mon Dec 13, 2010 12:21 pm
by WaltBrown
Did you try something like?

Code: Select all

    local tTop, tLeft, tGrp, tGrpList
    -- Put list of grps affected into tGrpList

    put <desired starting top location> into tTop
    put <desired left location> into tLeft
    repeat for each grp tGrp in tGrpList
       set the topLeft of grp tGrp to tLeft,tTop
       put the bottom of grp tGrp into tTop
    end repeat
Or does the change to the boundary when you group the objects mess it up?

Re: Group Locations

Posted: Mon Dec 13, 2010 1:01 pm
by bsouthuk
Hi! Thanks for this - I have tried the script but get the folllowing error message:

button "Button": compilation error at line 7 (repeat: bad termination condition) near "tGrp", char 12

Re: Group Locations

Posted: Mon Dec 13, 2010 1:56 pm
by Klaus
Hi Daniel,

unfortunately "repeat for each..." does not work with object on cards!
Use "repeat with i = 1 to the num of grps..." instead.

But please post your complete script to be sure!


Best

Klaus

Re: Group Locations

Posted: Mon Dec 13, 2010 2:42 pm
by WaltBrown
Sorry, I was too quick. I put this in a button and made 3 groups, G1, G2, and G3.

Code: Select all

on mouseUp
   local tTop, tLeft, tGrp, tGrpList, tGrpNum
    put "g1" & comma & "g2" & comma & "g3" into tGrpList
    put 50 into tTop
    put 50 into tLeft
    repeat with tGrpNum = 1 to the number of items in tGrpList
       put item tGrpNum of tGrpList into tGrp
       set the topLeft of grp tGrp to tLeft,tTop
       put the bottom of grp tGrp into tTop
    end repeat
end mouseUp


Re: Group Locations

Posted: Mon Dec 13, 2010 2:47 pm
by bsouthuk
Briliant thank you very much!!!

What actually determines the gap in between each group?

Re: Group Locations

Posted: Mon Dec 13, 2010 4:03 pm
by bn
Hi Daniel,

it is the borderwidth of the group (if shown and greater than 0) and the margins of the group. Look in the properties inspector -> Text formatting. Set the margins to 0 and if the border is not shown then you will see the groups stacked upon each other.

regards

Bernd

Re: Group Locations

Posted: Mon Dec 13, 2010 4:06 pm
by bsouthuk
wow - that simple, fantastic. Thank you for your help!