Page 1 of 1

Assign name to Group

Posted: Wed Sep 23, 2015 9:17 am
by samjith
How to give a name to a group. I tried with this code. but it is not working. (it shows name as "group id 495423").

repeat with i= 3 to the number of groups of this cd
set selected of group i to true
end repeat
group
set the name of the last group to "s"

and How to lock size and position of a group. I used this code.

set the resizable of group "s" to true

But it, shows error
button "1": execution error at line n/a (Object: can't set this property)

Plzz help :D

Thanks
Sam

Re: Assign name to Group

Posted: Wed Sep 23, 2015 10:33 am
by jmburnod
Hi Sam,

I tested your script and it doesn't work.
As you, I can't rename last group.
I tried a send in time way but it doesn't work too, but I'm sure someone have a trick
I have noticed you want use resizable property but it works only for stack
For control you have to use lockLoc property

Best regards
Jean-Marc

Re: Assign name to Group

Posted: Wed Sep 23, 2015 10:40 am
by samjith
Hi,
I used this below script, now it works. But i know it is not the correct way.

set the name of the selectedobjects to "s"

But the resize property works, while clicking through inspector.

and one more thing

is there any way to give name to vscrollbar by script. i used this code

set the vScrollBar of group "s" to "true"

Thank you

Re: Assign name to Group

Posted: Wed Sep 23, 2015 10:42 am
by samjith
Lockloc property works. thanks

Re: Assign name to Group

Posted: Wed Sep 23, 2015 10:53 am
by jmburnod
Hi
But the resize property works, while clicking through inspector.
Yes for a stack but not for a control
set the name of the selectedobjects to "s"
Thanks. I will test it after cleaning garden :D

Re: Assign name to Group

Posted: Wed Sep 23, 2015 10:58 am
by SparkOut
The renaming problem is is because of the layering, when groups contain nested groups. The group object has a layer number, which is the "floor" for the member objects, each member object will have a layer higher than its parent group.
When you create a new group which contains other groups, the newly created group "owner" will have a layer "floor" lower than the containing groups. Therefore given your code, the "last" group will be one of the member groups, not the newly created one. If the new group is going to contain every group on the card, then all the member groups will have a higher layer than the parent group, so your newly created all-encompassing parent group will be group number 1.

Contrast the following :

Code: Select all

   repeat with i = 1 to the number of buttons of this card
      set the selected of button i to true
   end repeat
   group
   set the name of last group to "grpButtons"

Code: Select all

   repeat with i = 1 to the number of groups of this card
      set the selected of group i to true
   end repeat
   group
   set the name of group 1 to "grpOvergroup"

Re: Assign name to Group

Posted: Wed Sep 23, 2015 1:20 pm
by samjith
Hi SparkOut

You are right. Works fine. thanks

is there any way to color vscroll bar?

Re: Assign name to Group

Posted: Wed Sep 23, 2015 1:38 pm
by jmburnod
Hi SparkOut,

Thanks for explanations. That is clearer for me
Best regards
Jean-Marc

Re: Assign name to Group

Posted: Wed Sep 23, 2015 2:45 pm
by dunbarx
The "last" keyword is not stable with groups. Don't do it.

I added a user note in the dictionary a while back.There is a workaround, using the templateGroup. Check out the entry...

Craig Newman