Page 1 of 1

Strangeness getting list of objects in a group

Posted: Fri Sep 04, 2009 6:07 pm
by phaworth
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

Posted: Fri Sep 04, 2009 7:59 pm
by Mark
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