|
From: Media Post on 13 Feb 2006 11:50 Hello! I am trying to revise a glossary project that was created a while back in Director 7(by a former co-worker) and not sure why it's not working in Director MX 2004. The Director project consists of two text fields. The left side lists the glossary terms (which are just the Defininition titles typed into a Director field) and the right side field will list the definitions once a term is clicked. The project uses the FileIO xtra to Get the Definintions from an external txt file. The txt file looks like this: #Add Mode Add Mode The Add Mode in the Bar List Input Screen is a material-entry mode in which new items are added at the bottom of the current takeoff. Most takeoff items are normally entered in Add Mode. #Address Option Address Option The Address option checkbox on the Report Options tab on the Bar List Report screen enables you to print your company name and address on the Bar List Report. ...and so on. From looking at the Director File, it looks as though whenever you hilite a title in the "Terms" field, the definitions field is populated with the definition of that term from the txt file. My problem is that I can't get the definition to be displayed in the field, it just displays the whole txt file and not just the definition of what is hilited. Below is the initial movie script: Global DefinitionList_lst on ReadGlossaryFile Put Into DefinitionList_lst Put "" Into Definition_s Put "" Into KeywordList_s Set TermFile to new (xtra "FileIO") OpenFile(TermFile, "glossary.txt", 1) Put GetLength(TermFile) Into FileLength_l Repeat While GetPosition(TermFile) < FileLength_l Put ReadLine(TermFile) Into InputLine_s If Length(KeywordList_s) > 0 Then Put Char 2 To Length(InputLine_s) Of InputLine_s Into InputLine_s End If If Char 1 of InputLine_s = "#" Then -- Line is a new term line, get rid of # Put Char 2 To Length(InputLine_s) Of InputLine_s Into InputLine_s If Length(KeywordList_s) > 0 Then -- Append definition bag to definition list and empty bag Append(DefinitionList_lst, Definition_s) Put "" Into Definition_s End If Put KeywordList_s & InputLine_s Into KeywordList_s Else -- Line is part of the definition Put Definition_s & InputLine_s Into Definition_s End If End Repeat Append(DefinitionList_lst,Definition_s) -- Store the last definition CloseFile(TermFile) Set the text of member "Definitions" To KeywordList_s buildlist("Definitions") end ReadGlossaryFile on buildList fieldName global gMyList gMyList = textString = field fieldName set the itemDelimiter = RETURN lineCount = the number of lines in textString repeat with whichLine = 1 to lineCount add gMyList, line whichline of field fieldname end repeat sort gMyList deleteat gmylist,1 end Here is the mousedown script for the terms: Global DefinitionList_lst on mouseDown Hilite line (the mouseLine) of member "Terms" if the mouseline <= DefinitionList_lst.count then Set the text of member "Definitions" to GetAt(DefinitionList_lst, the mouseLine) else exit end if end on beginSprite me sprite(me.spriteNum).member.scrollTop = 0 end I'm not familiar with the fileIO xtra, so any help would be greatly appreciated. Thanks in advance! ~Christy
From: JB on 13 Feb 2006 23:33 One thought I don't see right off what would have broken since director 7, but the amount of fileio code could be reduced to just a few lines by reading the entire file into memory, parcing it in memory using lingo string expressions, in place of the fileIO GetPosition, GetLength, etc. I suspect the speed might be better, as well as debuging. Text parcing has been somewhat improve since 7.0 set the itemdelimiter = "#" data = readFile.item[4].line[3].word[2] extracts a spcific bit in a single line
From: Media Post on 14 Feb 2006 10:37 Thank you very much! I will try your suggestion. ~Christy
|
Pages: 1 Prev: Full screen movie Next: send lingo commands fro <a href? |