It's late, I'm tired and grouchy and I can't figure out a way to do this!
David Burgun
dburgun at dsl.pipex.com
Fri Apr 7 07:26:11 EDT 2006
Hi,
I took the following code and massaged it into my Script to form the
function below, but it still doesn't work! See the end of the message
for a list of the objects visited. I just want a loop(s) that visits
each object just once!
On 7 Apr 2006, at 02:39, J. Landman Gay wrote:
>
> on scanObjs
> repeat with x = 1 to the number of bgs
> repeat with n = 1 to the number of bg controls of bg x
> <do something to bg control n of bg x>
> end repeat
> end repeat
> repeat with x = 1 to the number of cds
> repeat with n = 1 to the number of cd controls of cd x
> <do something to cd control n of cd x>
> end repeat
> end repeat
> end scanObjs
Anyone have any pointers on how to do this? I'm looking through the
documentation now. I am 99.99% certain that I had some code that did
this once upon a time, but I just can't seem to find it!
Thanks a lot
All the Best
Dave
------------------------------------------------------------------------
--
-- XISMInitialzeObjects
--
------------------------------------------------------------------------
-
function XISMInitialzeObjects theStackLongName,theColdStartFlag
local myCardIndex
local myControlIndex
local myCount
local myHandlerString
local myColdStartFlag
local mySendString
local myBackgroundIndex
get ISMSetDebugMode(true,true)
if theColdStartFlag = empty then
put false into myColdStartFlag
else
put theColdStartFlag into myColdStartFlag
end if
get ISMDebugLogString("ISMInitialzeObejcts " & theStackLongName)
get ISMDebugLogString()
put "on " & kInitializeObjectName into myHandlerString
put kInitializeObjectName && myColdStartFlag into mySendString
--
-- Initialize the Stack
--
if the script of theStackLongName contains myHandlerString then
send mySendString to stack theStackLongName
end if
repeat with myBackgroundIndex = 1 to the number of backgrounds of
theStackLongName
get ISMDebugLogString("myBackgroundIndex:" && myBackgroundIndex)
repeat with myControlIndex = 1 to the number of background
controls of background myBackgroundIndex of theStackLongName
get ISMDebugLogString(the name of control myControlIndex of
theStackLongName)
end repeat
get ISMDebugLogString(empty)
end repeat
get ISMDebugLogString(empty)
get ISMDebugLogString(empty)
get ISMDebugLogString(empty)
repeat with myCardIndex = 1 to the number of cards of
theStackLongName
get ISMDebugLogString("myCardIndex:" && myCardIndex)
repeat with myControlIndex = 1 to the number of card controls of
card myCardIndex of theStackLongName
get ISMDebugLogString(the name of card control myControlIndex
of card myCardIndex of theStackLongName)
end repeat
get ISMDebugLogString(empty)
end repeat
-- --
-- -- Initialize all Cards that need to be Initialized
-- --
-- repeat with myCardIndex = 1 to the number of cards in
theStackLongName
-- if the script of card myCardIndex of stack theStackLongName
contains myHandlerString then
-- send mySendString to card myCardIndex of stack
theStackLongName
--
-- --
-- -- Initialize all Controls that need to be Initialized
-- --
--
-- repeat with myControlIndex = 1 to the number of controls
in card myCardIndex of stack theStackLongName
-- if the script of control myControlIndex of card
myCardIndex of stack theStackLongName contains myHandlerString then
-- send mySendString to control myControlIndex of card
myCardIndex of stack theStackLongName
-- end if
-- end repeat
-- end if
-- end repeat
return true
end XISMInitialzeObjects
myBackgroundIndex: 1
group "GroupTitle"
field "LabelTitle"
group "GroupCardTabMenu"
myBackgroundIndex: 2
group "GroupTitle"
myBackgroundIndex: 3
group "GroupTitle"
field "LabelTitle"
group "GroupCardTabMenu"
button "MenuCardTab"
group "GroupImportFolder"
field "LabelImportFolder"
myBackgroundIndex: 4
group "GroupTitle"
field "LabelTitle"
group "GroupCardTabMenu"
button "MenuCardTab"
group "GroupImportFolder"
field "LabelImportFolder"
field "FieldImportFolder"
button "ButtonChooseDataFolder"
group "GroupImportContactFiles"
field "LabelTotalContacts"
field "LabelTotalContactsValue"
field "FieldImportFilePathNames"
button "ButtonAddFile"
myBackgroundIndex: 5
group "GroupTitle"
myBackgroundIndex: 6
group "GroupTitle"
field "LabelTitle"
myBackgroundIndex: 7
group "GroupTitle"
field "LabelTitle"
group "GroupCardTabMenu"
button "MenuCardTab"
group "GroupImportFolder"
field "LabelImportFolder"
field "FieldImportFolder"
button "ButtonChooseDataFolder"
group "GroupImportContactFiles"
field "LabelTotalContacts"
field "LabelTotalContactsValue"
field "FieldImportFilePathNames"
button "ButtonAddFile"
button "ButtonRemoveFile"
button "ButtonImportAll"
myCardIndex: 1
group "GroupImportFolder"
field "LabelImportFolder"
field "FieldImportFolder"
button "ButtonChooseDataFolder"
group "GroupImportContactFiles"
field "LabelTotalContacts"
field "LabelTotalContactsValue"
field "FieldImportFilePathNames"
button "ButtonAddFile"
button "ButtonRemoveFile"
button "ButtonImportAll"
group "GroupDatabase"
field "LabelTotalDatabaseContacts"
field "LabelTotalDatabaseContactsValue"
field "LabeDatabaseFileName"
field "LabeDatabaseFileNameValue"
field "LabelDupeContacts"
field "LabelDupeContactsValue"
field "LabelContactsAdded"
field "LabelContactsAddedValue"
field "LabelContactsUpdated"
field "LabelContactsUpdatedValue"
button "ButtonAddToDatabase"
button "ButtonSaveDatabase"
button "ButtonDeleteDatabase"
image "ImageRightArrow"
button "Button"
button "Button"
myCardIndex: 2
group "GroupContactDetails"
field "FieldNumberOfContactsValue"
field "FieldNumberOfContacts"
field "FieldCompanyNameList"
field "FieldAddress"
field "FieldContactName"
field "FieldPostCode"
field "FieldPhoneNumber"
field "FieldEmalAddress"
field "FieldTypeCode"
field "FieldCompanyName"
group "GroupFilter"
button "ButtonFilterA"
button "ButtonFilterB"
button "ButtonFilterC"
button "ButtonFilterS"
More information about the use-livecode
mailing list