Autor Beitrag
bruce185
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Sa 29.04.06 20:04 
hallo,
ich hab da ma ne fragenwenn ich mit der Maus auf ein Bestimmte Text drauf bin, das dieser Text wo die Maus drauf ist, Rot dargestellt wird, und wenn die Maus wieder weg vom Text ist das des dann wieder weiss wird, so meine ich das:

user defined image

also das nur bestimmte wörter Rot Dargestellt wird, z.B. steht da Hallo mein lieber! wie gehts?

das dann halt nur Hallo und gehts? rot angezeigt werden kann, wie mach ich das jetzt?
Für hilfen bin ich euch sehr dankbar :?

Gruss Andreas


Moderiert von user profile iconraziel: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Sa 29.04.2006 um 21:05
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Sa 29.04.06 21:07 
woran hakts, herausbekommen, wo sich der mauscursor befindet, bzw über welchem buchstaben, oder beim highlighten ?
bruce185 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: Sa 29.04.06 21:57 
sry, ich weiss es aber wirklich net wie sowas geht, könntest du es mir vieleicht zeigen, ein beispiel Code wäre wirklich net verkehrt, ich bin dir schonmal sehr dankbar :D

Gruss Andreas
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 30.04.06 09:22 
user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
woran hakts, herausbekommen, wo sich der mauscursor befindet, bzw über welchem buchstaben, oder beim highlighten ?


ich kann dir nur helfen wenn du mir das beantwortest ;)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 30.04.06 19:35 
Hallo,

wie du den Text unterm MausZeiger rausbekommst, muß schon irgendwo im Forum stehen.

Auf die Schnelle:

ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
  private der Form
    { Private-Deklarationen }
    FOldSelStart,FoldselLength:Integer;
....
procedure TForm1.RichEdit1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
Var pt:tpoint;
    i,iAnfang,iEnde:integer;
    s:string;
    Richedit:TRichEdit;
begin
  Richedit:=Sender as TRichEdit;

  pt:= point(x,y);
  i := SendMessage(RichEdit.Handle, EM_CHARFROMPOS, 0, longint(@pt));

  //anfang und ende suchen
  iAnfang := i;
  iEnde   := i;

  while (iAnfang>0) and (not (RichEdit.Text[iAnfang] in [' ','.',',',';',#13,#10]) ) do dec(ianfang);
  while (iEnde<length(RichEdit.Text)) and (not (RichEdit.Text[iEnde] in [' ','.',',',';',#13,#10]) ) do inc(iEnde);

  //text im Label anzeigen
  s:=copy(RichEdit.Text,iAnfang+1,iEnde-iAnfang-1);
  label1.Caption := '"'+s+'"';

  if iAnfang<>FOldSelStart then
    begin
      //vorige Seletion wieder normal
      RichEdit.SelStart:=FOldSelStart;
      RichEdit.SelLength:=FoldselLength;
      RichEdit.SelAttributes.Color:=clWindowText;

      //Text unter Cursor rot
      RichEdit.SelStart:=iAnfang;
      RichEdit.SelLength:=iEnde-iAnfang-1;
      RichEdit.SelAttributes.Color:=clred;

      FOldSelStart:=RichEdit.SelStart;
      FoldselLength:=RichEdit.SelLength;
    end;
end;


Rest mußt du dir selber anpassen. Es gibt sicher ein paar Probleme, wenn du scrollst oder das Grid editierst.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
bruce185 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 283

winXP
D7 Ent
BeitragVerfasst: So 30.04.06 20:13 
ich bin dir sehr dankbar das du dir die mühe gegeben hast das zu machen :lol:

aber ich möchte das nur bestimmte wörter Markiert werden kann, halt net alles was in RichEdit1 steht, sry ich kenne mich noch net so gut aus mit delphi :(

danke dir schonmal :wink:

Gruss Christian
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 01.05.06 07:39 
und wo ist das problem, zu prüfen, ob s dein "bestimmtes Wort ist"?

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)