Autor Beitrag
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 09.04.06 18:37 
Hallo!

Wie kann ich einen Text ins synedit feld laden?

so funktioniert das leider nicht :-(

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.ToolbarButton9721Click(Sender: TObject);
var datum: String;
begin
datum:=LoadFormFile(ExtractFilePath(ParamStr(0))+'datum.txt');
SynEdit1.SelText:=datum
end;


Wie könnte es nur funktionieren

Danke für jede Hilfe

Moderiert von user profile iconTino: Titel erweitert.
Moderiert von user profile iconTino: Topic aus Sonstiges (Delphi) verschoben am So 09.04.2006 um 21:35
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: So 09.04.06 18:43 
probier's mal mit SynEdit.Lines.LoadFromFile(...)

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 09.04.06 18:45 
ich möchte den text aber zu einem bestehenden text hinzufügen.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 09.04.06 18:47 
Ich würd mal sagen die Datei erst in eine Stringlist speicher und dann einfügen.
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 09.04.06 18:49 
wie geht das? :(
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: So 09.04.06 18:51 
etwas so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
sl: TStringList;
{..}
begin
 try
  sl := TStringList.Create;
  sl.LoadFromFile(...);
  SynEdit.Lines:AddStrings(sl);
 finally
  sl.Free;
 end;


mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 10.04.06 09:00 
Titel: so
user profile iconGSE hat folgendes geschrieben:
etwas so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
sl: TStringList;
{..}
begin
 try
  sl := TStringList.Create;
  sl.LoadFromFile(...);
  SynEdit.Lines:AddStrings(sl);
 finally
  sl.Free;
 end;


mfg
GSE
s

so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
sl: TStringList;
begin
 try
  sl := TStringList.Create;
  sl.LoadFromFile(...);
  SynEdit.Lines:=(sl);
 finally
  sl.Free;
 end;
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 10.04.06 09:19 
War das jetzt eine Frage, oder Feststellung ?
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 10.04.06 09:23 
user profile iconBlackheart666 hat folgendes geschrieben:
War das jetzt eine Frage, oder Feststellung ?


feststellung, dass es so klappt
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 10.04.06 09:33 
user profile iconmuppet max hat folgendes geschrieben:
ich möchte den text aber zu einem bestehenden text hinzufügen.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var  
sl: TStringList;
begin
 try  
  sl := TStringList.Create;
  sl.LoadFromFile('C:\test.txt');
  SynEdit1.SelText:=Trim(sl.Text);
 finally
  sl.Free;
 end; 
end;
muppet max
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 10.04.06 09:35 
user profile iconBlackheart666 hat folgendes geschrieben:
user profile iconmuppet max hat folgendes geschrieben:
ich möchte den text aber zu einem bestehenden text hinzufügen.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var  
sl: TStringList;
begin
 try  
  sl := TStringList.Create;
  sl.LoadFromFile('C:\test.txt');
  SynEdit1.SelText:=Trim(sl.Text);
 finally
  sl.Free;
 end; 
end;


danke !
:D :D :D :D :D :D :D :D :D :D :wink: :wink: :wink: