I have a problem with making groups act like independent objects which I can
cut and paste into and out of each other. For this I need to be able to send
messages to a groups contents, that is the objects (groups, and controls)
that it contains.
The problem is that all of Metacards function (except "groupNames" and
"groupIds" which do not work with groups), return a list of all the objects
inside a group including those nested inside the groups it contains.
The way I've had to do it therefore is to get all the long names and test
each long name against the name of the group to see if it is only one level
down in the hierarchy.
I don't think there is anyway round this, or any undiscovered features to
explore, so I include the function I have written to get a list of the first
level objects inside a group. Luckily Metacard is so fast it seems to work
fine for Geometry Management on an iMac....
However take a look - it end up being pretty complex (and I have'n't
bothered with players and images):
function getMyObjects someGroup
if someGroup is empty then put the long name of the target into someGroup
put getMyButtons(someGroup) into myObjects
get getMyFields(someGroup)
addTo_Container it, myObjects
get getMyGroups(someGroup)
addTo_Container it, myObjects
return myObjects
end getMyObjects
on addTo_Container linesToAdd, @containerToSet
if containerToSet is empty then
put linesToAdd into containerToSet
else if linesToAdd ‚ empty then
put containerToSet & return & linesToAdd into containerToSet
end if
end addTo_Container
function getMyButtons someGroup
put empty into allNestedObjects
put the number of buttons of someGroup into someMax
repeat with btnNum = 1 to someMax
put the long name of btn btnNum of someGroup into someObject
put someObject & return after allNestedObjects
end repeat
delete last char of allNestedObjects
return filterLevelOneObjects(allNestedObjects, someGroup, "button")
end getMyButtons
function getMyFields someGroup
put empty into allNestedObjects
put the number of flds of someGroup into someMax
repeat with fldNum = 1 to someMax
put the long name of fld fldNum of someGroup into someObject
put someObject & return after allNestedObjects
end repeat
delete last char of allNestedObjects
return filterLevelOneObjects(allNestedObjects, someGroup, "field")
end getMyFields
function getMyGroups someGroup
if someGroup is empty then put the long name of the target into someGroup
put allMyGroups(someGroup) into nestedGroups
return filterLevelOneObjects(nestedGroups, someGroup, "group")
end getMyGroups
function filterLevelOneObjects objectIndex, someObject, objectType
put "^" & objectType && "(" & anyQuotedReg() & ")" && "of" && someObject
into someReg
put empty into filteredObjects
repeat for each line someGroup in objectIndex
if matchText(someGroup, someReg) is true then
put someGroup & return after filteredObjects
end if
end repeat
delete last char of filteredObjects
return filteredObjects
end filterLevelOneObjects
function allMyGroups someObject
if someObject is empty then put the name of the target into someObject
put the number of groups of someObject into allNestedGroupNum
put empty into myGroups
repeat with groupNum = 1 to allNestedGroupNum
put the long name of group groupNum of someObject into someGroupName
put someGroupName & return after myGroups
end repeat
delete last char of myGroups
return myGroups
end allMyGroups
function anyQuotedReg
return quote & "[^" & quote & "]*" & quote
end anyQuotedReg
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.