Autor Beitrag
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mi 27.10.04 02:46 
wie kann ich eine "gehe zu zeile"-funktion in einem editor realisieren?


Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Mi 27.10.2004 um 10:29
NeWsOfTzzz
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 233


D4 Prof
BeitragVerfasst: Mi 27.10.04 02:51 
Vielleicht mal konkreter werden? ich kann mir da leider nix genau drunter vorstellen..
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mi 27.10.04 04:00 
na in einem memo. zb gehe zu zeile 200 schau dir mal die funktion des notepade bei
"bearbeiten -> gehe zu" an. sowas meine ich in eine bestimmte zeile in einem momo springen.
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Mi 27.10.04 04:13 
Bei einem Synmemo mit:
ausblenden Delphi-Quelltext
1:
SynMemo1.GotoLineAndCenter(ZEILENNUMMER);					


Bei einem Memo hätte ich es so getan:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var i, c: Integer;
begin
    for i := 0 to ZEILENNUMMER do
        begin
            c := c + Length(Memo1.Lines[i]);
        end;
    Memo1.SelStart := c;
    Memo1.SelLength := 0;
end;

(nicht getestet)

Hoffe ich konnte helfen

_________________
Klein, schwarz und ärgert Techniker? Jumper!
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mi 27.10.04 04:32 
Synmemo??? kenn ich leider nicht. hat meine delphi-hilfe auch nicht ausgespuckt.

beim 2. code beispiel springt der cursor bis in die letzte zeile nicht in die gewünschte. ich versuche mir aber das prinzip umzubauen

thx
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Mi 27.10.04 05:50 
Titel: Re: wie kann ich "gehe zu zeile"-funktion realisie
User-Xy2004 hat folgendes geschrieben:
wie kann ich eine "gehe zu zeile"-funktion in einem editor realisieren?


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure ScrollToLine(AMemo: TMemo; Line: Integer);
var
  I: Integer;
  Counter: Integer;
begin

  Counter := 0;

  for I := 0 to Line - 2 do
    Counter := Counter + Length(AMemo.Lines.Strings[I]) + 2;

  with AMemo do
  begin
    SelStart := Counter;
    SelLength := 0;
    SetFocus;
  end;

end;

_________________
Ciao, Sprint.
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Mi 27.10.04 09:43 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure GotoZ(Zeile : Integer);
var
  a : Integer;
begin
  a:=Memo.Perform(EM_GETFIRSTVISIBLELINE,0,0);
  Memo.Perform(EM_LINESCROLL,0,Zeile-a);
end;


Gruß,
Jörg

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 27.10.04 10:29 
Titel: Re: wie kann ich "gehe zu zeile"-funktion realisie
Hallo!

User-Xy2004 hat folgendes geschrieben:
wie kann ich eine "gehe zu zeile"-funktion in einem editor realisieren?

Schau dir mal bitte diesen FAQ Beitrag an: ...die Zeile/Spalte in Memos lesen/setzen?

Gruß
Tino
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Mi 27.10.04 12:24 
problem behoben. habe die lösung von @Sprint übernommen.

nun gehts.

danke an alle bemühten