Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs

September, 2005
    01 02 03
04 05 06 07 08 09 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30

Search the weblog

Genii Weblog

Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.

Fri 9 Sep 2005, 04:22 PM
In the midst of testing for Notes/Domino 7, I have been finalizing some new samples for the Midas Rich Text LSX.  One is the Color code LotusScript and Formula language sample, which I use quite often when posting code.  In a self-referential kind of move, here is the code in the Color code LotusScript agent.  Pretty handy for posting samples on forums:

Sub Initialize
   ' *** Domino front-end classes
   Dim ws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   ' *** Domino front-end classes
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim unid As String
   Dim mode As Integer
   Dim flag As Variant
   Dim textfrom As String
   Set db = session.CurrentDatabase
   Set uidoc = ws.CurrentDocument
   mode = uidoc.EditMode
   Set doc = uidoc.Document
   On Error Goto ErrorHandler
   Dim rtitem As New GeniiRTItem
   Dim rtchunk As GeniiRTChunk
   ' *** Connect to Body field and perform highlight  ****
   Call rtitem.ConnectBackend(doc.Handle, "Body", False)
   rtitem.CacheLinkMatching = True
   If rtitem.IsConnected Then
      If mode Then uidoc.Save
      Set rtchunk = rtitem.DefineChunk("Everything")
      rtchunk.TextWildcards = True      
      rtitem.HighlightFont = "DarkGreen"
      Call rtchunk.HighlightText(|'*|+Chr(0))
      rtitem.HighlightFont = "Blue"
      Call rtchunk.HighlightMatching("", db.FilePath, "LotusScript Reserved Words", "ReservedWord", "", "MinLength=2")
      Call rtchunk.HighlightText("=")
      Call rtchunk.HighlightText("(")
      Call rtchunk.HighlightText(")")
      Call rtchunk.HighlightText("&")
      Call rtchunk.HighlightText(",")
      Set uidoc = ws.EditDocument(mode, doc)
   End If
   Exit Sub   
   Print "Error is& Cstr(Err) & "(& Cstr(Error(Err)) & ")"
   Resume Next
End Sub

Copyright 2005 Genii Software Ltd.