Autor Beitrag
mattl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 11:54 
Habe zwar schon im Forum eine Zeit lang nach einem solchem Thema gesucht habe aber leider nichts gefunden

Also ich möchte einen bestimmten Teilstring eines Labels bzw. einer Memo durch eine andere Schrift oder Hintergrundfarbe hervorheben

Schon im voraus danke für eure Hilfe


Moderiert von user profile iconGausi: Topic aus Sonstiges (Delphi) verschoben am Mi 02.08.2006 um 13:32
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mi 02.08.06 12:21 
Hier gibts eine extra Kompo die Highlighten kann

Mit einem Memo geht das gar nicht aber mit einem RichEdit:
Suche in der Entwickler-Ecke SELATTRIBUTES
Leuchtturm

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 13:17 
ich habe hier leider nur einen beitrag gefunden der mich weiter gebracht hat und der funktioniert auch nur mit einzelnen Zeichen und mit der Kombo kann ich leider auch nichts anfangen
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 13:21 
hab mich da jetzt nich schlau drüber gemacht, aber mir würd spontan einfallen, wenn du's mit labels machen willst, teil deinen string doch auf mehrere labels auf, dann kannst du für die einzelnen jeweils die eigenschaften ändern...
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mi 02.08.06 13:30 
user profile iconmattl hat folgendes geschrieben:
... mit der Kombo kann ich leider auch nichts anfangen

Mit dem RichEdit??
Ist bei win32 die 4. kompo(delphi 7)
Leuchtturm

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 14:10 
nicht mit richedit sondern mit der von deinem link
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 15:49 
habe jetzt mal das memo feld durch ein richedit ersetzt da es ja mit memos nicht funktioniert
galagher
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2562
Erhaltene Danke: 46

Windows 10 Home
Delphi 10.1 Starter, Lazarus 2.0.6
BeitragVerfasst: Mi 02.08.06 17:21 
Hallo!

Ich denke, TGSFormattedLabel ist das, was du brauchst! Google mal danach!

_________________
gedunstig war's - und fahle wornen zerschellten karsig im gestrock. oh graus, es gloomt der jabberwock - und die graisligen gulpen nurmen!
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 17:38 
ja das TGSFormattedLabel ist ja das von dem Link
wie funktioniert den das mit der installation der Kombo bzw. wie funktioniert die dann
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: Mi 02.08.06 18:57 
und da hab ich extra sone nette ReadMe geschrieben :(

_________________
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)
galagher
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2562
Erhaltene Danke: 46

Windows 10 Home
Delphi 10.1 Starter, Lazarus 2.0.6
BeitragVerfasst: Mi 02.08.06 19:06 
user profile iconmattl hat folgendes geschrieben:
ja das TGSFormattedLabel ist ja das von dem Link
wie funktioniert den das mit der installation der Kombo bzw. wie funktioniert die dann

Installieren wie alle anderen Komponenten auch :nixweiss:
Wie die funktioniert: Da gibt's eine Datei GSFormattedLabel-Readme.txt (englisch, leider!) dazu und ausserdem einen Ordner "Demo". Und: Ausprobieren! Ich habe herausgefunden, dass die Komponente auch fehlertolerant ist - sie macht dann einfach nichts!

Ich weiss, das mit der Syntax ist ein wenig gewöhnungsbedürftig, aber die Kompo ist doch ok, oder?

_________________
gedunstig war's - und fahle wornen zerschellten karsig im gestrock. oh graus, es gloomt der jabberwock - und die graisligen gulpen nurmen!
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Mi 02.08.06 19:17 
mal sehen ob ich das zum laufen bringe mir wäre es jetzt aber eigentlich wichtiger das ich den teilstring in einem Richedit kennzeichnen kann
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Do 03.08.06 08:17 
so habe das problem gelöst hab jetzt zwar vor und nach dem makiertem bereich einen Zeilenumbruch aber naja
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 03.08.06 08:40 
Hallo,
user profile iconmattl hat folgendes geschrieben:
so habe das problem gelöst hab jetzt zwar vor und nach dem makiertem bereich einen Zeilenumbruch aber naja
wie hast Du es denn gelöst?
Zeig doch mal deinen Code, das kann man sicherlich auch ohne Umbruch realisieren.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Spaceguide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 552


(D3/D7/D8) Prof.
BeitragVerfasst: Do 03.08.06 08:57 
user profile icongalagher hat folgendes geschrieben:
Ich habe herausgefunden, dass die Komponente auch fehlertolerant ist - sie macht dann einfach nichts!


Nicht gerade meine Auffassung von Fehlertoleranz ;-)
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Do 03.08.06 09:41 
so hier mal mein Code ..
ich nehme den text kopiere dann den teil bis zum Teilstring zurück in das Richedit dann kopiere ich mit einer anderen Formatierung den zu hervorhebenden Teilstring in das Richedit dann Formatierung wieder zurück gestellt und den Rest auch noch in das Richedit eingefügt (sicher eine Anfängerlösung aber ich bin ja auch ein Anfänger)


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
var text,suchw: string;
i,e:integer;

begin
  text:=richedit1.Text;
  suchw:=edit1.Text;
  richedit1.Clear;
  e:=pos(lowercase(suchw),lowercase(text));
  i:=length(suchw) ;

  richedit1.Lines.add(copy(text,0,e-1));
  RichEdit1.SelAttributes.Color := clred;
  richedit1.Lines.add(copy(text,e,i));
  RichEdit1.SelAttributes.Color := clyellow;
  richedit1.Lines.Add(copy(text,e+i,length(text))) ;


end;


durch das .lines.add entseht eben bei jedem Einfügen ein Zeilenumbruch
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: Do 03.08.06 09:55 
user profile iconSpaceguide hat folgendes geschrieben:
user profile icongalagher hat folgendes geschrieben:
Ich habe herausgefunden, dass die Komponente auch fehlertolerant ist - sie macht dann einfach nichts!


Nicht gerade meine Auffassung von Fehlertoleranz ;-)
eigentl. stellt sie den text dann einfach unformatiert da, wenn Tags falsch sin oder so. war auch so beabsichtigt. glaube er meint das so, nicht dass si ega rnichts darstellt ;)

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)
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 03.08.06 15:52 
Hallo,
user profile iconmattl hat folgendes geschrieben:
...sicher eine Anfängerlösung aber ich bin ja auch ein Anfänger...
jeder ist mal angefangen :wink:

Man kann das gefundene Wort direkt ohne irgendwelche Kopieraktionen einfärben.
z.B.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var suchw : string;
         i : integer;
begin
  suchw := Edit1.Text;
  i := Pos(LowerCase(suchw),LowerCase(RichEdit1.Text));
  if i > 0 then
    begin
    RichEdit1.SelStart  := i-1;//Cursor vor gefundenes Wort setzen
    RichEdit1.SelLength := Length(suchw);//gefundenes Wort markieren
    RichEdit1.SelAttributes.Color := clred;//einfärben
    end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
mattl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 77

Win Xp Pro
Deplphi 3 Pro,Delphi 2005 PE
BeitragVerfasst: Do 03.08.06 15:58 
ok jetzt bin ich 100% zufrieden

thx @ all