Attribute VB_Name = "modRTB"
'MOD with subs for displaying text in RTB's (RIch Text Boxes)

Public Sub Display(text As String, rtb As RichTextBox, color As Long, Italics As Boolean, Bold As Boolean, Newline As Boolean, Underlined As Boolean)
    
    With rtb
       If Len(.text) + Len(s) > 15000 Then
            .SelStart = 0
            .SelLength = InStrRev(.text, vbCrLf, Len(.text) - 2000, vbTextCompare) + 1
            .SelText = ""
        End If
        .SelStart = Len(.text)
        .SelColor = color
        .SelBold = Bold
        .SelItalic = Italics
        .SelUnderline = Underlined
        If Newline = True Then
            .SelText = text & vbCrLf
        Else
            .SelText = text
        End If
        .SelStart = Len(.text)
    End With
    
End Sub

Public Sub DisplayMessage(Form As Form, rtb As RichTextBox, Nickname As String, Message As String, color As Long)
    
    'Decrytion routine
    If Form.mnuDecrypt.Checked = True Then
        If Form.key = "" Then Form.key = InputBox("Please enter Encryption Key", "Enter Key")
        Message = DeCrypt(Message, Form.key)
    End If
    'display formatted message
    Display "<" + Nickname + "> ", rtb, color, False, frmmain.chksenderBold.value, False, False
    Display Message, rtb, color, False, False, True, False

End Sub

