Page 1 of 1

Many groups in my card

Posted: Mon Mar 21, 2016 12:29 pm
by macera
Hi all,

I am beginner in LiveCode, I have so many groups in my card, I have to find out the name of nested group. When I click a particular group it must display name of the group and other groups inside that group. Is it possible :(

Thanks

Re: Many groups in my card

Posted: Mon Mar 21, 2016 3:08 pm
by dunbarx
Hi.

Check out the "owner" in the dictionary.

But this will be tricky, depending on how your groups are nested. For example, if you have a two buttons ("A" and "B") in a group, and you have this in the button "A" script:

Code: Select all

on mouseUp
   put the owner of me
end mouseUp
You will get the group than contains it. But now group that group with another group, and place the same handler in the lower group script. Click button "B". Now you get the name of the larger group.

As I said, this might get tricky.

Craig Newman

Re: Many groups in my card

Posted: Mon Mar 21, 2016 5:02 pm
by jmburnod
Hi Macera,
This function return a list like this.
Card name,Group name, backgroundbehavior of group,id of group, owner of group
One line per group

Code: Select all

function CheckAllGroups pNumcard --•• pNumCard = num of cd
   put the short name of cd pNumcard into tNameCD
   put the num of groups of  cd pNumcard into tNbGr
   if tNbGr = 0 then
      put tNameCD & cr into tLesGr
   else
      repeat with i =1 to tNbGr
         put the short id of group i of cd pNumcard into tGrID
         put the backgroundbehavior of group id tGrID into tBB
         put the short name of group id tGrID into tNameGr
        put the owner of group  id tGrID into tOwner
         put tNameCD & "," & tNameGr & "," & tBB & "," & tGrID & "," & tOwner & cr after tLesGr
      end repeat
   end if
   delete char -1 of tLesGr
   return tLesGr
end CheckAllGroups
Best regards
Jean-Marc

Re: Many groups in my card

Posted: Tue Mar 22, 2016 2:09 pm
by Klaus
Hi macera,

1. welcome to the forum! :D
macera wrote:I am beginner in LiveCode, I have so many groups in my card, I have to find out the name of nested group.
2. If you are a beginner and lost oversight over your objects on a card, you should start thinking if you are really on the right track!?

Analyze your problem again and see if you can use less groups.
Maybe you want to tell us about your project and we can give you some useful hints.


Best

Klaus