Autor Beitrag
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: So 16.05.04 21:57 
Hi,

ich verwende 2 RxRichEdit-Formularfelder in denen sich formatierter Text mit Bilder befindet.

Wie kann ich nun feststellen, ob die Inhalte unterschiedlich sind.

Mit

ausblenden Delphi-Quelltext
1:
if RxRichEdit1.Lines<>RxRichEdit2.Lines then ShowMessage('Ungleich');					


bekomm ich immer die Meldung "Ungleich", auch wenn die Inhalte gleich sind. :shock:

Bin für jeden Hinweis dankbar.

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 16.05.04 22:45 
Hi,

Vielleicht so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function CompareRichEdits(const Re1, Re2: TRichEdit): Boolean;
var
  ms1, ms2: TMemoryStream;
begin
  Result := False; 
  ms1 := TMemoryStream.Create;
  try
    Re1.Lines.SaveToStream(ms1);
    ms2 := TMemoryStream.Create;
    try
      Re2.Lines.SaveToStream(ms2);
      if ms1.Size = ms2.Size then
        // Compare the streams, Streams vergleichen: 
        Result := CompareMem(ms1.Memory, ms2.Memory, ms1.Size)
      finally
        ms2.Free
    end
  finally
    ms1.Free
  end
end;