rtLib — Notes Rich Text Management Library Documentation of rtLib — Notes Rich Text Management Library Download rtLib — Notes Rich Text Management Library FAQ of rtLib — Notes Rich Text Management Library Purchase rtLib — Notes Rich Text Management Library Feedback about rtLib — Notes Rich Text Management Library

Cookbook

Area Hotspots

Start search Mail feedback Back to Description


rtGraphic rtMap rtHotLink rtLabel

add (rtContainer) addLink addNewLine (rtContainer) addNewLine (rTextParagraph) appendText (rtContainer) appendText (rTextParagraph) ActionFormula Add (rtCollection) Add (rTextParagraph) deleteLink getFirstElement (rtCollection) getFirstElement (rtContainer) getRichTextItem hasMoreElements Link Links Map NextElement Resource (rtGraphic) Resource (rtHotLink) Shape Text (rtHotLink) Text (rtLabel)

Code fragment from sample "Area Hotspots"; see full running samples in downloadable help.
ctxDump.getRichTextItem doc, "Body"

dim img as rtGraphic
dim map as rtMap, lnk as rtHotlink

set img = ctxDump.getFirstElement(RT_OBJ_GRAPHIC)
set Map = img.Map
if Not Map is Nothing then
dim en as rtEnumeration, obj
set en = Map.Links
do while en.hasMoreElements
set lnk = en.NextElement
ctxDump.addNewLine 1
ctxDump.appendText "Name: " &lnk.IDName &", formula: " &lnk.ActionFormula
Loop

set lnk = Map.Link ("LINK1")
if lnk is Nothing then
Print "link 1 is nothing"
Else
if lnk.Resource is Nothing then
Print "Link 1: resource is nothing"
Else
Print "Link 1: " &lnk.Resource.Text
End if
End if
set lnk = Map.Link ("LINK2")
ctxDump.addNewLine 1
ctxDump.appendText "Removing: " &lnk.IDName
Call Map.deleteLink (lnk.IDName)
' add one link
set lnk = new rtHotlink(0)
lnk.IDName = "Stranger"
ctxDump.addNewLine 1
ctxDump.appendText "Adding link: " &lnk.IDName

Map
.addLink lnk
' we can manipulate object also after adding -- any time before writing to item
lnk.ActionFormula ={@prompt([OK];"Hotspot Name";"} + lnk.IDName + {");""}
dim shape(3)
shape(0) = 20:shape(1)=80:shape(2)=180:shape(3)=200
lnk.Shape (shape) = AREA_SHAPE_RECT

' add URL link
set lnk = new rtHotlink(0)
set lnk.Resource = new rtLabel("http://www.ibm.com")
lnk.IDName = "Url Link to " &lnk.Resource.Text
ctxDump.addNewLine 1
ctxDump.appendText "Adding link: " &lnk.IDName

Map
.addLink lnk
shape(0) = 280:shape(1)=80:shape(2)=380:shape(3)=400
lnk.Shape (shape) = AREA_SHAPE_CIRCLE
End if