Assign name to Group

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
samjith
Posts: 85
Joined: Tue Mar 31, 2015 10:09 am

Assign name to Group

Post by samjith » Wed Sep 23, 2015 9:17 am

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Assign name to Group

Post by jmburnod » Wed Sep 23, 2015 10:33 am

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
https://alternatic.ch

samjith
Posts: 85
Joined: Tue Mar 31, 2015 10:09 am

Re: Assign name to Group

Post by samjith » Wed Sep 23, 2015 10:40 am

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

samjith
Posts: 85
Joined: Tue Mar 31, 2015 10:09 am

Re: Assign name to Group

Post by samjith » Wed Sep 23, 2015 10:42 am

Lockloc property works. thanks

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Assign name to Group

Post by jmburnod » Wed Sep 23, 2015 10:53 am

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
https://alternatic.ch

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Assign name to Group

Post by SparkOut » Wed Sep 23, 2015 10:58 am

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"

samjith
Posts: 85
Joined: Tue Mar 31, 2015 10:09 am

Re: Assign name to Group

Post by samjith » Wed Sep 23, 2015 1:20 pm

Hi SparkOut

You are right. Works fine. thanks

is there any way to color vscroll bar?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Assign name to Group

Post by jmburnod » Wed Sep 23, 2015 1:38 pm

Hi SparkOut,

Thanks for explanations. That is clearer for me
Best regards
Jean-Marc
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Assign name to Group

Post by dunbarx » Wed Sep 23, 2015 2:45 pm

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

Post Reply