return "TOOLTIP" & RETURN & RETURN & "Generates a tool tip when the user rolls over the sprite." & RETURN & RETURN & "NOTE: This behavior calls the 'Display Text' behavior to actually show the message. " & "The 'Display Text' behavior must be attached to a different sprite which contains either a Field or a Text member." & RETURN & RETURN & "If such a sprite exists, it will automatically be selected in the Behavior Parameters dialog." & RETURN & RETURN & "If you wish the Tooltip to appear in a given position relative to the current sprite, choose the appropriate position in the Behavior Parameters dialog, and ensure that the associated 'Display Text' behavior is set to act as a Tooltip. " & "(If the 'Display Text' behavior is set to act as a Status Bar, then it will ignore any position data and appear in a fixed position)." & RETURN & RETURN & "You can choose to have the tooltip appear immediately on rollover, or to appear only if the mouse remains over the sprite for a given period. " & "You can also choose to have the tooltip disappear if the user clicks on the sprite." & RETURN & RETURN & "The Behavior Parameters dialog has limited space for entering a tool tip message. " & "In particular, it will not accept a string which contains the RETURN character. " & "If you need to display a long Tooltip which consists of several lines of text, and which must appear at the position of this sprite, then you must use send a message to this behavior containing the requiresd string. " & "For example:" & RETURN & RETURN & " SendSprite (1, #Tooltip_SetMessage, " & QUOTE & "This message consists" & QUOTE & "&RETURN&" & QUOTE & "of two lines of text" & QUOTE & ")" & RETURN & RETURN & "This would produce the following message when the mouse rolls over sprite 1:" & RETURN & RETURN & " This message consists" & RETURN & " of two lines of text" & RETURN & RETURN & "If the tooltip generated by this behavior is to be diplayed in a Status bar then this step may be needed. " & " The 'Display Text' behavior will ensure that a long line of text is wrapped in the Status bar, and that scroll bars appear if necessary." & RETURN & RETURN & "PERMITTED MEMBER TYPES:" & RETURN & "All" & RETURN & RETURN & "PARAMETERS:" & RETURN & "* Tool tip to display (single-line string)" & RETURN & "* Delay before displaying tool tip (0 - 2 seconds)" & RETURN & "* Hide tool tip if sprite is clicked? (TRUE | FALSE)" & RETURN & "* Position of tool tip relative to the sprite" & RETURN & " (This will be ignored if the 'Display Text' behavior is set to act as a status bar)." & RETURN & "* Number of the sprite where tool tip is to be displayed." & RETURN & " (This sprite should have the 'Display Text' behavior attached to it. " & " If the given sprite is moved an authortime alert will invite you to update the Behavior Parameters)." & RETURN & RETURN & "PUBLIC METHODS:" & RETURN & "=> Set the tooltip message (allows the RETURN character)" & RETURN & "=> Obtain behavior reference" & RETURN & RETURN & "ASSOCIATED BEHAVIORS:" & RETURN & "+ Display Text - ESSENTIAL - must be attached to a Field or Text sprite which covers the same span of frames." & RETURN & RETURN & "You can find the 'Display Text' behavior in the Library Palette, under Controls > Display Text."
end
on getBehaviorTooltip me
return "Use with any type of member." & RETURN & RETURN & "Generates a tool tip message when the mouse is over the sprite." & RETURN & RETURN & "This behavior requires that the 'Display Text' behavior be available on a Field or Text sprite to display the messages that it generates. " & "If no such sprite is available an alert will appear (authortime only)." & RETURN & RETURN & "The parameter set for the associated 'Display Text' behavior determines whether the tool tip message appears in a Status Bar or as a temporary Tooltip display over or near this sprite."
displayScriptMember = the number of member "Display Text"
if displayScriptMember > 0 then
displayScriptMember = member(displayScriptMember)
repeat with theSprite = 1 to the lastChannel
theScripts = sprite(theSprite).scriptList
scriptCount = theScripts.count()
repeat while scriptCount
if theScripts[scriptCount][1] = displayScriptMember then
return theSprite
end if
scriptCount = scriptCount - 1
end repeat
end repeat
end if
return the currentSpriteNum + 1
end
on Tooltip_SetMessage me, thestring
case ilk(thestring) of
#string:
otherwise:
return #invalidTypeError
end case
myString = thestring
end
on Tooltip_GetReference me
return me
end
on ErrorAlert me, theError, data
behaviorName = string(me)
delete word 1 of behaviorName
delete char -30001 of behaviorName
delete char -30001 of behaviorName
case data.ilk of
#void:
data = "<void>"
#symbol:
data = "#" & data
end case
case theError of
#invalidSpriteNumber:
if the runMode = "Author" then
message = substituteStrings(me, "Sprite ^3 did not respond to a #DisplayText call. " & " Another sprite will be used. " & " Please open the Behavior Parameters dialog to choose the correct sprite for displaying the Tooltip message.", ["^0": the frame, "^1": me.spriteNum, "^2": behaviorName, "^3": data])
end if
alert(message)
#noValidSprites:
if the runMode = "Author" then
message = substituteStrings(me, "BEHAVIOR ERROR: Frame ^0, Sprite ^1 " & RETURN & "Behavior ^2" & RETURN & RETURN & "No sprites responded to a #DisplayText call." & RETURN & RETURN & "Please ensure that the '^3' behavior is attached to a Field or Text Sprite in the same frames as Sprite ^1.", ["^0": the frame, "^1": me.spriteNum, "^2": behaviorName, "^3": "Display Text"])
end if
alert(message)
end case
end
on substituteStrings me, parentString, childStringList