Highlights lines pointed to in #text members. Returns a call to a handler when a line is clicked. Sets a global when a line is clicked.
-- By Warren "The Howdy Man" Ockrassa, warren@nightwares.com
-- this will hilite lines rolled over in a text member
-- it will also initiate a call to a handler on mouseUp
-- by default the handler"s name is commented out; you can change it later
-- when you have a handler to call, but can leave it commented just to test the functionality
-- of the behavior
-- the following globals are set by this behavior and may be accessed from other scripts
-- for example they can be used in the handler you specify
on GetBehaviorDescription
sContent = "This works only with #text members." & RETURN & RETURN & "It allows you to set hilites for lines rolled over by the mouse, and passes back a call to a handler when a line is clicked."
return sContent
END GetBehaviorDescription
on GetBehaviorTooltip
sContent = "This works only with #field members." & RETURN & RETURN & "It allows you to set hilites for lines rolled over by the mouse, and passes back a call to a handler when a line is clicked."
return sContent
END GetBehaviorTooltip
on BeginSprite me
pnHiliteSprite = the currentSpriteNum
pnHiliteMember = sprite(pnHiliteSprite).memberNum
END BeginSprite
on MouseWithin me
member(pnHiliteMember).foreColor = pnNonHiliteColor
myParagraph = pointToParagraph ( sprite pnHiliteSprite, the mouseLoc )
if myParagraph < 1 then exit
member(pnHiliteMember).line[myParagraph].foreColor = pnHiliteColor
END MouseWithin
on MouseDown me
myParagraph = pointToParagraph ( sprite pnHiliteSprite, the mouseLoc )
if myParagraph < 1 then exit
member(pnHiliteMember).line[myParagraph].foreColor = pnClickColor
updateStage
startTimer
repeat while the timer < pnHiliteDelay
nothing
end repeat
END MouseDown
on MouseUp me
myParagraph = pointToParagraph ( sprite pnHiliteSprite, the mouseLoc )
if myParagraph < 1 then exit
member(pnHiliteMember).line[myParagraph].foreColor = pnHiliteColor
gnLineHiLiterBehaviorLineNumberReturn = myParagraph
gsLineHiLiterBehaviorStringReturn = member(pnHiliteMember).paragraph[myParagraph].text
do psDoHandler
END MouseUp
on MouseLeave me
member(pnHiliteMember).foreColor = pnNonHiliteColor
END MouseLeave
on GetPropertyDescriptionList me
if not ( the currentSpriteNum ) then
-- behavior has been dropped on the script channel; kickout
exit
end if
pnHiliteSprite = the currentSpriteNum
pnHiliteMember = sprite(pnHiliteSprite).memberNum
if member(pnHiliteMember).type <> #text then
-- must happen on text members only!
exit
end if
return [ #pnHiliteColor: [ #comment: "What is the hilite color you want?", #format: #integer, #default: 1, #range: [#min: 0, #max: 255] ], #pnNonHiliteColor: [ #comment: "What is the non-hilite color you want?", #format: #integer, #default: ( member(pnHiliteMember).foreColor ), #range: [#min: 0, #max: 255] ], #pnClickColor: [ #comment: "What is the mouseDown color you want?", #format: #integer, #default: 0, #range: [#min: 0, #max: 255] ], #pnHiliteDelay: [ #comment: "How long (in ticks) do you want a clicked line to remain hilited?", #format: #integer, #default: 10, #range: [#min: 0, #max: 60] ], #psDoHandler: [ #comment: "What is the name of the handler you want called?", #format: #string, #default: "-- MyHandler()" ] ]
END GetPropertyDescriptionList
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA