Strangeness getting list of objects in a group

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
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Strangeness getting list of objects in a group

Post by phaworth » Fri Sep 04, 2009 6:07 pm

I have a procedure which goes through all the groups on a card and builds a list of objects with a certain naming convention within each group. This has been working fine until I recently needed to nest a couple of groups within each other. Now the objects returned by my code within the nested group are the wrong objects. The number of objects it sees is correct but the wrong objects are returned.

The code looks like this:

Code: Select all

function getDBobjectIDs pObject
   put empty into myList
  repeat with x = 1 to number of controls of pObject
     if "DB_" is in the name of control x of pObject  then 
           put the abbrev name of control x of  pObject  & return after myList
     end if
  end repeat
  return myList
end getDBobjectIDs
pObject is the abbrev name of a group on the card.

The group structure as I see it in the Application browser looks like this

GroupA
FieldA1
FieldA2
FieldAn
GroupB
FieldB1
FieldB2
FieldB3

When the code processes the GroupB object, it correctly processes three objects within the group, the objects returned are not FieldB1 - FieldB3. Instead it returns the the first three (by layer) objects on the card.

I hope I explained this clearly enough!

Any ideas as to why this is happening and how I can fix it?

Thanks,
Pete

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Sep 04, 2009 7:59 pm

Hi Pete,

You could group the remaining objects in the main group. That way, you'll have two groups with controls inside one group that has no controls of its own besides the two nested groups.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply