Many groups in my card

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
macera
Posts: 1
Joined: Mon Mar 21, 2016 12:26 pm
Contact:

Many groups in my card

Post by macera » Mon Mar 21, 2016 12:29 pm

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

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

Re: Many groups in my card

Post by dunbarx » Mon Mar 21, 2016 3:08 pm

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
Last edited by dunbarx on Mon Mar 21, 2016 5:25 pm, edited 1 time in total.

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

Re: Many groups in my card

Post by jmburnod » Mon Mar 21, 2016 5:02 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Many groups in my card

Post by Klaus » Tue Mar 22, 2016 2:09 pm

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

Post Reply