This "Getting started..." series of articles shows simple code snippets to demonstrate how to use common features of the Midas Rich Text LSX. These are not meant to be full fledged samples, for which you could go to the Midas Samples page, but rather small bits of code to show how to get started. These articles will also appear in the Reference section of the Midas Help db in somewhat altered form.
The Midas Rich Text LSX lets you find, create, manipulate and extract doclinks. The most common tasks are accessing doclinks and retrieving their values, changing one or more component of all doclinks in a rich text field, and adding a new doclink. Below are some quick code snippets to show these tasks. Additional information can be found in the Midas Help db along with information about the individual properties and methods which relate to doclinks.
Accessing all doclinks and getting their values
Set rtchunk = rtitem.DefineChunk("Doclink 1")
If rtchunk.Exists Then
Do
Messagebox _
"Replica ID: " & rtchunk.LinkReplicaID & Chr(10) & _
"View UNID: " & rtchunk.LinkViewUniversalID & Chr(10) & _
"Note UNID: " & rtchunk.LinkNoteUniversalID & Chr(10) & _
"Popup text: " & rtchunk.LinkPopupText & Chr(10) & _
"Hint server: " & rtchunk.LinkHintServer & Chr(10) & _
"Anchor text: " & rtchunk.LinkAnchorText, _
0, "Doclink Information for " & rtchunk.Definition
Loop Until Not rtchunk.GetNextTarget
End If
Accessing all hyperlinks (link hotspots on text) and getting their values
Set rtchunk = rtitem.DefineChunk("Hyperlink 1")
If rtchunk.Exists Then
Do
Messagebox _
"Link hotspot: " & rtchunk.Text & Chr(10) & _
"Replica ID: " & rtchunk.LinkReplicaID & Chr(10) & _
"View UNID: " & rtchunk.LinkViewUniversalID & Chr(10) & _
"Note UNID: " & rtchunk.LinkNoteUniversalID & Chr(10) & _
"Popup text: " & rtchunk.LinkPopupText & Chr(10) & _
"Hint server: " & rtchunk.LinkHintServer & Chr(10) & _
"Anchor text: " & rtchunk.LinkAnchorText, _
0, "Hyperlink Information for " & rtchunk.Definition
Loop Until Not rtchunk.GetNextTarget
End If
Changing one component of all doclinks (e.g., changing view unid to use All Documents view)
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.ChangeDoclinks("", view.UniversalID)
Changing one component of all doclinks that match a specific component (e.g., changing view unid to use All Documents view if the replica id is the current database)
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.ChangeDoclinks("", view.UniversalID, "", "", "", Ucase(db.ReplicaID))
Creating a new doclink using AppendLink
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.AppendLink("", db.ReplicaID, view.UniversalID, doc.UniversalID, "Follow link by clicking here...")
Creating a new hyperlink (link text hotspot) using AppendLink
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.AppendLink("My link", db.ReplicaID, view.UniversalID, doc.UniversalID, "Follow link by my link...")
Copyright © 2003 Genii Software Ltd.