On Monday, June 30, 2003, at 12:01 PM, [EMAIL PROTECTED] wrote:

--__--__--


Message: 7
Date: Mon, 30 Jun 2003 07:29:17 -0500
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: <lingo-l> totally stumped
Reply-To: [EMAIL PROTECTED]

Help! I am totally stumped after 4 very long days of trying to figure this
out! I thought I understood lists and very simple "databases"--just saving
and opening a text file with fileIO. Well silly me!


I have a section of this CDRom I am working on that has to capture the text
of a checkbox, add it to a linear list (gMark1), and then somehow, some way
store it in my database (gDatabase) list at a particular property location.
Before it gets stored as a property list in my gDatabase, I need to display
the captured text as text (not a list with the quotes and brackets) in a
field member.


Well, I can get the linear list developed, I can display it as a list in the
field member with all the brackets and quotes and commas, I can even get it
into the gDatabase, but I can't figure out how to put the linear list at the
exact property location in gDatabase and I can't figure out how to display
the contents of the linear list without it being in list form (just the
text). sigh.
[...]

Chris,


If I understand correctly, you have checkboxes as data entry - of which I assume you want to collect the text if hilited, a global variable containing a linear list acting as a buffer where you store the collected strings, and a global variable containing a property list that act as a permanent storage. Unless I fail miserably in comprehending the situation, most of what you want can be accomplished with three handlers (not counting the initialization on start movie) such as:

< movie script begin>

global gMark1,gDatabase

on startMovie
  gMark1 = []
  gDatabase = [#prop1:[],#prop2:[],#prop3:[]]
  member("displayField").text = ""
  -- and a few checkBox members (checkBox1, checkBox2,checkBox3)
end startMovie

--HANDLER to collect data from hilited checkbox in a list
on addToLinear whichCheckBoxList,whichList
  whichList = []
  -- add to linear list if checkBox hilited
  repeat with x = 1 to whichCheckBoxList.count
    if member(whichCheckBoxList[x]).hilite then
      whichList.add(member(whichCheckBoxList[x]).text)
    end if
  end repeat
end addToLinear

--HANDLER to store a list under a specific property in a propList
on storeInDB whichList,whichDB,whichProp  -- NOTE: whichProp is a string
  whichDB[whichProp] = whichList
end storeInDB

--HANDLER to display any list (of strings) in any field with one item per line
on displayListInField whichList,whichField
member(whichField).text = ""
repeat with x = 1 to whichList.count
member(whichField).line[x] = whichList[x]
end repeat
end displayListInField



--For example:


--addToLinear(["checkBox1","checkBox2","checkBox3"],gMark1)
-- -- will add the text of all hilited checkboxes from the list to gMark1


--displayListInField(gMark1,"displayField")
-- -- will display the content of gMark1 in the field "displayField"

--storeInDB(gMark1,gDatabase,"prop2")
-- -- will store gMark1 at property #prop2 of the property list contained in gDatabase


--displayListInField(gDatabase[#prop2],"displayField")
-- -- will display the content stored at property #prop2 of gDatabase in the field "displayField"



-- ALTERNATIVE HANDLER to bypass the buffer and to display right away on storeDirectInDB whichCheckBoxList,whichDB,whichProp whichDB[whichProp] = [] -- need this to overwrite repeat with x = 1 to whichCheckBoxList.count if member(whichCheckBoxList[x]).hilite then whichDB[whichProp].add(member(whichCheckBoxList[x]).text) end if end repeat displayListInField(whichDB[whichProp],"displayField") end storeDirectInDB

--Example:
--
storeDirectInDB(["checkBox1","checkBox2","checkBox3"],gDatabase,"prop1")
-- -- will store as a linear list the text of all hilited checkboxes in the list under -- -- property #prop1 of the property list contained in gDatabase (and display the result)


<movie script end>

I also suggested the alternative handler above as I couldn't be certain that you really need that gMark1 buffer. Why not collect and store in one shot? The data, once in gDatabase, is always there waiting...

All of the above only crudely tested and in dire need of paranoïcs (error checking procedures).

Denis

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to