Page 1 of 1

grouping dynamically created groups with the group command

Posted: Fri Jan 02, 2015 10:55 pm
by magice
a have a script that clones a template group of fields based on a user controlled number of data entries and places each newly created group below the previous. Now I need to create a scrollbar for when the number of groups exceed the length of the stack. It was my thought to group all of the dynamically created groups into a master group and then set the vScrollbar and hScrollbar to true. The group command however does not seem to like my syntax.

Code: Select all

repeat with i= 1 to the number of groups in cd 1
      put the short name of grp i of cd 1 into tName
      put tName&&"and "before tGList
   end repeat
   delete the last word in tGList  
   group tGlist --Here it hangs it doesn't seem to like "group id xxx and group id xxx etc"
   put it into tMasterGroup
   set the vScrollbar of tMasterGroup to true
    set the hScrollbar of tMasterGroup to true
How would be a better way of doing this?

Re: grouping dynamically created groups with the group comma

Posted: Sat Jan 03, 2015 4:11 am
by magice
Never mind, after fighting with this for awhile I has one of those "I'm such an idiot" moments and realized that the scroll bars would not work anyway because they will be the height of the master group not the height of the stack. So I just ended up scripting a separate scroll bar object to do the job. I should have just done that in the first place.

Re: grouping dynamically created groups with the group comma

Posted: Sat Jan 03, 2015 1:03 pm
by Klaus
Hi Magice,

this should work also:

Code: Select all

...
put it into tMasterGroup
set the vScrollbar of tMasterGroup to true
set the hScrollbar of tMasterGroup to true
set the rect of tMasterGroup to the rect of this cd
set the lockloc of tMasterGroup to TRUE
...
Another way of grouping excisting object is to do somethig like this:

Code: Select all

...
repeat with i = 1 to the number of groups OF cd 1
  set the SELECTED of grp i OF cd 1 to TRUE
end repeat
## Now all groups are selected:
GROUP
## Done! Now DE-select everything again:
select empty
## :-)
...
Best

Klaus