Domino Code Fragment

Code Name*
Create a new class to display objects
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.133.120.10
Description*
A very simple example might be to create a class to display a message. We’ll do this in LotusScript by creating a class called DisplayMsg. In the following listing, the DisplayMsg class is shown, where you will see a property called Text and a method called Display.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Once you have created the object, you can set the text property by referring to it as object.property, or objMsg.Text in this case. You can cause the code in the Display method (function) to execute using the same process.
Files/Graphics attachments (if applicable): Code:
Class DisplayMsg
' Declare member variables in a LotusScript class
mMsg As String
mMsgNumber As Integer
Public Property Set Text As String
mMsg = Text
End Property
Public Sub Display
Msgbox(mMsg)
End Sub
End Class

The text for the class is entered into the declarations of a Notes form. The code in the next listing is entered into the Sub Click event of a button on this Notes form. Here you will see a variable created as a variant called objMsg, which will be used to hold the instance of our message object. The set objMsg = New DisplayMsg line actually creates the instance of the object and loads a reference of it into the objMsg variable.

Sub Click (Source As Button)
Dim objMsg as Variant
Set objMsg = New DisplayMsg
objMsg.Text = "(" & Format$(68) & ") - " & Error$(68)
objMsg.Display
Delete objMsg
End Sub