Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Pulser
Sending a e-mail with attachment using CDO and VbScriptXtra
Progress Bar
Filtering - Valentina
Determine if a Year is a Leap Year
DExport 1.0
Tristate button with caption
XTRA dmmXSC - a client for XML Socket Server
ECTI Editor
AutoCropper v1.2
 

 

 

Behavior LineHiLiter

Added on 6/30/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: WarrenOckrassa

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

GLOBAL gsLineHiLiterBehaviorStringReturn, gnLineHiLiterBehaviorLineNumberReturn
PROPERTY pnHiliteColor, pnNonHiliteColor, pnClickColor, pnHiliteDelay, pnHiliteSprite, pnHiliteMember, psDoHandler

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

Send e-mail