AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Desaströse Performance von TRichedit

Ein Thema von Maekkelrajter · begonnen am 11. Sep 2024 · letzter Beitrag vom 12. Sep 2024
Antwort Antwort
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.753 Beiträge
 
Delphi 12 Athens
 
#1

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 14:01
TextDateien ohne Formatierung ... warum überhaupt in ein RichEdit anstatt in ein Memo?
Na ja, weil:
Aber einige optische Gimmicks wie mehrfarbiger Text sind eben mit einem TMemo nicht zu realisieren.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.542 Beiträge
 
Delphi 12 Athens
 
#2

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 15:08
TextDateien ohne Formatierung ... warum überhaupt in ein RichEdit anstatt in ein Memo?
Na ja, weil:
Aber einige optische Gimmicks wie mehrfarbiger Text sind eben mit einem TMemo nicht zu realisieren.
ups.

SynEdit/SynMemo oder dergleichen?
oder das neue Direct2D-RichEdit ... müsste man doch bestimmt gut im FireMokey einbinden können.
(der Start von dem Geraffel dauert zwar ewig, aber danach scheint es schnell zu sein)
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
456 Beiträge
 
#3

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 15:16
What about this
Delphi-Quellcode:
var
  Stream: TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  try
    Stream.LoadFromFile(FILE_NAME);
    SendMessage(RichEdit1.Handle, WM_SETTEXT, LPARAM(0), WPARAM(Stream.Memory)); // better to add to the stream another byte with 0 or double bytes with 0, but for testing now
    //Stream.Position := 0;
    //RichEdit1.Lines.LoadFromStream(Stream);
  finally
    Stream.Free;
  end;
end;
Kas
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.542 Beiträge
 
Delphi 12 Athens
 
#4

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 15:23
What about this
And this is supposed to work in a Delphi since 2009?

SendMessage = SendMessageW = Unicode
Is your file also Unicode?
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
456 Beiträge
 
#5

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 15:29
What about this
And this is supposed to work in a Delphi since 2009?

SendMessage = SendMessageW = Unicode
Is your file also Unicode?
It should !

Notice by sending the stream in full as it in the file, meaning the header included U+FEFF BOM header, yet the Window class recognized it, and handle it right, this even should work with Delphi 5.

But was it faster ?
Kas
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.753 Beiträge
 
Delphi 12 Athens
 
#6

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 15:31
Is your file also Unicode?
At least the example files posted above are.

Anyway, the TMemoryStream approach is quite similar to setting the Text or SelText with a string. It doesn't affect the performance, though.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
456 Beiträge
 
#7

AW: Desaströse Performance von TRichedit

  Alt 12. Sep 2024, 16:00
What about this
And this is supposed to work in a Delphi since 2009?

SendMessage = SendMessageW = Unicode
Is your file also Unicode?
Yes after re-reading more, i think WM_SETTEXT with Delphi 5 or may be even Delphi 7 might not work, as it will fail to handle the BOM marker for UTF16, as the used RichEdit class is version 1.0 and it is
Zitat:
ANSI (single-byte character set (SBCS) and multibyte character set (MBCS)) editing
So will work if the class changed to version 2.0, yet i might be wrong though, all in all this need more digging.
Kas
  Mit Zitat antworten Zitat
Antwort Antwort

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:50 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz