Autor Beitrag
delphi-programmierer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48

DOS, WIN XP
RAD Studio 2010, Turbo Pascal 6.0
BeitragVerfasst: Sa 06.01.07 11:21 
Hallo Leute,

wie kann ich mit dem TFindDialog und dem TReplaceDialog Text in meinem TSynEdit suchen bzw. ersetzen. Ich weiß, dass bei den SynEdit-Komponenten auch solche Komponenten dabei sind, die aber weniger benutzerfreundlich sind. Deshalb wollte ich den TFindDialog und den TReplaceDialog dazu verwenden.

MfG Paul
Andidreas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

Windows XP Pro
BDS 2006
BeitragVerfasst: Sa 06.01.07 12:04 
Finden:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure TForm1.fddFind(Sender: TObject);
var
  rOptions: TSynSearchOptions;
  sSearch: string;
begin
  sSearch := fdd.FindText;
  if Length(sSearch) = 0 then begin
    Beep;
  end else
  begin
    rOptions := [];
    if not (frDown in fdd.Options) then
      Include(rOptions, ssoBackwards);
    if frMatchCase in fdd.Options then
      Include(rOptions, ssoMatchCase);
    if frWholeWord in fdd.Options then
      Include(rOptions, ssoWholeWord);
    if seScript.SearchReplace(sSearch, '', rOptions) = 0 then
      Beep;
    end;
end;


Ersetzen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.frdReplace(Sender: TObject);
var
  rOptions: TSynSearchOptions;
  sSearch: string;
begin
  sSearch := frd.FindText;
  if Length(sSearch) = 0 then
  begin
    Beep;
  end
  else
  begin
    rOptions := [];
    if frMatchCase in frd.Options then
      Include(rOptions, ssoMatchCase);
    if frWholeWord in frd.Options then
      Include(rOptions, ssoWholeWord);
    if frReplaceAll in frd.Options then
      Include(rOptions, ssoReplaceAll);
    if seScript.SearchReplace(sSearch, frd.ReplaceText, rOptions) = 0 then
      Beep;
  end;
end;
delphi-programmierer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48

DOS, WIN XP
RAD Studio 2010, Turbo Pascal 6.0
BeitragVerfasst: So 07.01.07 11:53 
Danke.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 07.01.07 22:11 
Hallo
Hab das mal ausprobiert mit der Suche das klappt, aber mit dem Replace Dialog nicht.
Vieleicht hab Ich auch was verkehrt gemacht.
Hab die procedure Find im OnFind und Replade im OnReplace
eingebunden haut aber leider nicht hin.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Mo 08.01.07 11:59 
wenn ich mich recht erinnere dann ist auch ein "Suchen und Ersetzen"-Demo bei der TSynEdit Sourcen dabei. hast du dir die mal angeschaut?

Lg, Martin

_________________
Ein Nutzer der Ecke ;-)
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 08.01.07 22:28 
user profile iconMartin1966 hat folgendes geschrieben:
wenn ich mich recht erinnere dann ist auch ein "Suchen und Ersetzen"-Demo bei der TSynEdit Sourcen dabei. hast du dir die mal angeschaut?

Lg, Martin

Ja hab Ich aber da schaut kein Mensch durch (Zumindest Ich nicht);

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Andidreas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

Windows XP Pro
BDS 2006
BeitragVerfasst: Do 11.01.07 17:40 
FindDialog und FinAndReplaceDialog auf das Formular ziehen.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 11.01.07 19:08 
Danke für die Antwort, habs mittlerweile hinbekommen mit einigen Umstellungen und erstellung eines eigenen Dialogs.
FindandReplace Dialog ist Mir allerdings völlig Unbekannt.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Andidreas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

Windows XP Pro
BDS 2006
BeitragVerfasst: Do 11.01.07 19:19 
Ja, heißt ja auch FindReplaceDialog. Sorry.