Autor Beitrag
Wolfgang
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Fr 20.01.06 09:42 
Hi!

Kann mir bitte jemand sagen, wie ich aus einem memo nur den vom Benutzer markierten Text auswählen kann, um danach zB die Schriftart von diesem Text ändern zu können?

Bsp: Memo1 Text:

Text, Text, Text, markierter Text, Text, Text, Text!

Das mit der Schriftart, Farbe oder Größe ist ja kein Problem. Ich brauche nur die Auswahl des markierten Textes, da nur "markierter Text" bearbeitet werden soll.

thx im Vorhinein!

_________________
Two or three tons of stone can really get you down, and keep you there!
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Fr 20.01.06 09:45 
Also mit einem Memo funktioniert das leider nicht. Um das umzusetzen musst du ein TRichedit-Feld nehmen. Dieses hat dann die Property SelAttributes mit der du dann die Attribute des markierten Textes ändern kannst.

Alstar
Wolfgang Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Fr 20.01.06 10:31 
Erstmal Danke!

Aber ich möchte den Editor von Windows verbessert nachprogrammieren. Mit dem RichEdit speichert er die Daten jetzt aber in einer anderen Weise.
Bsp:
{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil MS Sans Serif;}}
\viewkind4\uc1\pard\lang3079\f0\fs16 ysdfjklasdf alksdjfasdf
\par asdf adsf \lang1031\f1
\par }

Wie kann ich bei der Funktion Öffnen jetzt den Text in das RichEdit laden?

Mit dem Memo hab ich das so gemacht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm3.Button1Click(Sender: TObject);
var
  filename, s: string;
  infile: Textfile;
begin

form1.Memo1.Clear;
filename:=directorylistbox1.directory;
AssignFile(infile, filename+filelistbox1.Items.Strings[filelistbox1.itemindex]);
Reset(infile);
  repeat
  Readln(infile, s);
  form1.Memo1.lines.add(s);
  until s='';
CloseFile(infile);
form3.Hide;

end;


thx Wolfgang

_________________
Two or three tons of stone can really get you down, and keep you there!
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Fr 20.01.06 10:44 
Schau dir mal LoadFromFile und SaveToFile an. :wink:
Gehört zu der Lines-Eigenschaft des TMemo.
Wolfgang Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Fr 20.01.06 11:00 
thx an Alle!

Hab das jetzt mit loadfromfile und selattributes gemacht und funktioniert einwandfrei.

Ohne dem forum wär ich voll am A****!

Danke Wolfgang!

_________________
Two or three tons of stone can really get you down, and keep you there!