TRVChat.AddMessage

<< Click to display table of contents >>

TRVChat.AddMessage

The methods add a new message to the end of the chat. Two methods with the same functionality, differing only in how parameters are passed directly or via a record.

function AddMessage(AUser: TRVChatUser

  const AText: TRVUnicodeString;
  ADateTime: TDateTime = 0; 

  Extra: TRVChatMessageExtra = nil;
  AState: TRVChatMessageState = rvcmsDefault): 

  TRVChatMessage
 
function AddMessage(

  const Data: TRVChatMessageInsertionInfo):

  TRVChatMessage

The methods add a new message to the end of the chat. They update both the content of ChatRichView and append an item to the end of Messages.

The methods expect ChatRichView to be formatted before they are called. They format the added message.

If ChatRichView was scrolled to the very bottom, it will be scrolled to the end of the newly added message; otherwise, the vertical scroll position remains unchanged.

Parameters

AUser – a reference to the user (the author of this message). This is a reference to one of items in Users.

AText – message text. If (Extra = nil) or (Extra is TRVChatMessageExtraQuote), AText cannot be empty. AText can be multi-line. The chat automatically detects URLs in the text (see RVIsURL).

ADateTime – message time. If 0, the current time is used.

Extra – additional data attached to the message: files, an image, or a quote. It may be an object the following classes:

TRVChatMessageExtraFiles to attach files

TRVChatMessageExtraImage to attach an image

TRVChatMessageExtraQuote to add a quotation

nil to attach nothing.

If Extra.AutoDestroy = True, this method frees Extra (if the message was added successfully)

AState – message status.

Return value

A reference to the appended message on success; nil otherwise.

See also:

InsertMessage