tmschat

The OnBeforeSendMessage event has an AAllow parameter that let's you prevent the messages to be added to the collection. This however also triggers for messages added using AddMessage so you'll need to implement OnSendButtonClick too to set a flag. Something like this:

procedure TForm3.FormCreate(Sender: TObject);
begin
  FSendButtonClick := False;
end;

procedure TForm3.TMSFNCChat1BeforeSendMessage(Sender: TObject;
  var AText: string; var AAllow: Boolean);
begin
  if FSendButtonClick then
  begin
    AAllow := False;
    //send AText to DB, sanitize first if necessary
    TMSFNCChat1.Memo.Lines.Clear;
    FSendButtonClick := False;
  end;
end;

procedure TForm3.TMSFNCChat1SendButtonClick(Sender: TObject);
begin
  FSendButtonClick := True;
end;