Recent

Author Topic: Anyone using lzrichedit or trichmemo for a chat type app?  (Read 12089 times)

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Anyone using lzrichedit or trichmemo for a chat type app?
« Reply #15 on: November 20, 2014, 01:36:43 am »
Just added. You can download it from here:

http://wiki.freepascal.org/lzRichEdit#Download


avra

  • Hero Member
  • *****
  • Posts: 1739
    • Additional info
Re: Anyone using lzrichedit or trichmemo for a chat type app?
« Reply #16 on: February 27, 2015, 02:19:33 pm »
If you need mixed coloring then this is an example that will add a new line with several different colored words to TRichMemo:

Example:
Black, Green, Blue, Red
Black, Green, Blue, Red
Black, Green, Blue, Red

Since none of forum examples worked for me, I found this working on Windows:
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
    procedure AddColorStr(s: string; const col: TColor = clBlack; const NewLine: boolean = true);
    begin
      with RichMemo1 do
      begin
        if NewLine then
        begin
          Lines.Add('');
          Lines.Delete(Lines.Count - 1); // avoid double line spacing
        end;
 
        SelStart  := Length(Text);
        SelText   := s;
        SelLength := Length(s);
        SetRangeColor(SelStart, SelLength, col);
 
        // deselect inserted string and position cursor at the end of the text
        SelStart  := Length(Text);
        SelText   := '';
      end;
    end;
  begin
    AddColorStr('Black, ');
    AddColorStr('Green, ', clGReen, false);
    AddColorStr('Blue, ', clBlue, false);
    AddColorStr('Red', clRed, false);
  end;

Hopefully someone having the same problem will find it, or decide to extend TRichMemo with a method that appends colored text...  ;)

Here is step by step tutorial: http://lazplanet.blogspot.com/2013/12/create-rich-text-editor-for-yourself.html

UPDATE1: I have just updated the Wiki. It would be nice if someone could test if this works on any other OS.
UPDATE2: Two more examples added: http://wiki.freepascal.org/RichMemo#Append_mixed_color_text_at_the_end_of_the_RichMemo
UPDATE3: Fixed scrolling error by changing example. Added link to blog tutorial.
« Last Edit: March 03, 2015, 08:33:31 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Dibo

  • Hero Member
  • *****
  • Posts: 1046
Re: Anyone using lzrichedit or trichmemo for a chat type app?
« Reply #17 on: February 27, 2015, 04:17:07 pm »
I'm using TIpHTMLPanel or THTMLPort for chat type app. You can then do whatever you want with text formatting and also add emoticons inside text

eldonfsr

  • Full Member
  • ***
  • Posts: 131
Re: Anyone using lzrichedit or trichmemo for a chat type app?
« Reply #18 on: February 28, 2015, 05:24:00 am »
I try to use richmemo for save in database but when i restore the rtc text the image gone only text show me i don't know what kind of image is support for richmemo i try jpg, also  i dont know is save rtf in sqlite works or not  bur for now i don't get its works for me.

eldonfsr

  • Full Member
  • ***
  • Posts: 131
http://www.swissdelphicenter.ch/en/showcode.php?id=1147
« Reply #19 on: March 10, 2015, 04:40:53 am »
This don't works on trichmemo i tested if you tested can you put your code pls.


typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Anyone using lzrichedit or trichmemo for a chat type app?
« Reply #20 on: March 10, 2015, 05:02:01 am »
lzRichEdit example attached.

JD

  • Hero Member
  • *****
  • Posts: 1762
Re: Anyone using lzrichedit or trichmemo for a chat type app?
« Reply #21 on: March 26, 2015, 05:46:21 pm »
I'm using TIpHTMLPanel or THTMLPort for chat type app. You can then do whatever you want with text formatting and also add emoticons inside text

Hi there Dibo. Would you mind showing me how you did that?

Thanks,

JD
Windows (10, 7) - Lazarus 2.0.6/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1