home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Magazine 28 Bonus
/
CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin
/
data
/
shared.dir
/
03027_Script_INDEX
< prev
next >
Wrap
Text File
|
1996-06-21
|
4KB
|
95 lines
-- --------------------------------------------------------------------------------------
-- Handler initializeIndex
on initializeIndex
global visitedIndicator
set visitedIndicator = 4
end
-- --------------------------------------------------------------------------------------
-- Handler doClickIndexList gets the buttonIndex of the button clicked, adds the button
-- to the list of clicked buttons for the given list, and calls the routine to do
-- what should be done for the clicked button.
on doClickIndexList whichList, buttonBar, numVItems, numHItems
if (numHItems = 0) then -- 1 dimensional vertical button bar
set whichButton = getVButtonIndex(buttonBar, numVItems, the mouseV)
else if (numVItems = 0) then -- 1 dimensional horizontal button bar
set whichButton = getHButtonIndex(buttonBar, numHItems, the mouseV)
else -- two dimensional button bar
set whichButton = getVHButtonIndex(buttonBar, numVItems, numHItems, the mouseV, the mouseH)
end if
updateVisitedSections(whichList, whichButton)
processClickedIndexButton(whichList, whichButton)
end
-- --------------------------------------------------------------------------------------
-- Handler processClickedIndexButton goes to the proper section for the button clicked.
on processClickedIndexButton whichList, whichButton
-- goSection(line whichButton of field ("Index List" && whichList), 1)
end
-- --------------------------------------------------------------------------------------
-- Handler updateVisitedSections maintains a list of items that have been selected and
-- visited from the index. This information is stored in the field "index visited sections"
-- where each line of the field corresponds to another list in the index.
on updateVisitedSections whichList, whichButton
-- check if the button clicked is already listed as one of the sections visited.
-- to check this, check if the button's index is already contained in the line for
-- the given index list. This checking is a bit tricky. The simple "contains" command
-- cannot be used because then if the list already contains the number "11", the number
-- "1" will not be added to the list. Instead, check if the word "1" is contained in the
-- the list. This way, the number may be duplicated (if it was the first button clicked) but
-- duplicated only once and at most, 1 button can be duplicated once.
if not(line whichList of field "index visited sections" contains (" " & string(whichButton) & " ")) then
put whichButton & " " after line whichList of field "index visited sections"
end if
end
-- --------------------------------------------------------------------------------------
-- Handler hiliteVisitedSections is called when entering the index. It hilites the
-- sections that have already been visited.
on hiliteVisitedSections whichList
global visitedIndicator
puppetSprite visitedIndicator, TRUE
set the trails of sprite visitedIndicator = TRUE
set locations = field ("index list" && whichList && "locations")
set visitedSections = line whichList of field "index visited sections"
repeat with i = 1 to the number of words in visitedSections
set currentSection = value(word i of visitedSections)
set sectionH = value(item 1 of line currentSection of locations)
set sectionV = value(item 2 of line currentSection of locations)
set the locH of sprite visitedIndicator = sectionH
set the locV of sprite visitedIndicator = sectionV
updateStage
end repeat
set the trails of sprite visitedIndicator = FALSE
puppetSprite visitedIndicator, FALSE
end
-- --------------------------------------------------------------------------------------
-- Handler doClickIndexTopics is called when the user clicks on an index topic.
on doClickIndexTopics topicsSprite, numItems
set whichList = getHButtonIndex(topicsSprite, numItems, the mouseH)
puppetSprite topicsSprite, TRUE
set the castNum of sprite topicsSprite = the number of cast ("indexHiliteSeg"&string(whichList))
showIndexList(whichList)
hiliteVisitedSections(whichList)
end
-- --------------------------------------------------------------------------------------
-- Handler showIndexList shows the list of items in the clicked index topic.
on showIndexList whichList
goFrame ("List" & whichList, "dissolve, pixels", 4)
end