Autor Beitrag
Mike_C
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Sa 01.11.03 15:42 
Hi

wie kann ich herausfinden, bei welchem wort in einem Memofeld der cursor gerade steht?
ich will damit sowas wie ne context-sensitive hilfe bauen mit der möglichkeit sich die hilfe über keywords einer script-sprache anzusehen. dazu will ich es wie in delphi ermöglichen auf ein wort zu klicken, f1 zu drücken und die hilfe angezeigt zu bekommen.

wie geht sowas?

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
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: Sa 01.11.03 17:52 
Hallo meinst du den Mauscursor oder den normalen Cursor?

für den mnormalen Cursor
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Memo1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
Var pt:tpoint;
    i,iAnfang,iEnde:integer;
    s:string;
begin
  pt:= point(x,y);
  //wo steht der Cursor im memo?
  i := memo1.selstart;
  //anfang und ende suchen
  iAnfang := i;
  iEnde   := i;

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

  s:=copy(memo1.Text,iAnfang+1,iEnde-iAnfang-1);
  label1.Caption := '"'+s+'"';
end;

das on mousedown ereignis ist nur zum testen ;)

Mfg Frank

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

Win XP
D7 Enterprise
BeitragVerfasst: Sa 01.11.03 18:09 
thx

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?