Autor Beitrag
Hochhaus
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 662
Erhaltene Danke: 8

Windows 7
Delphi XE2
BeitragVerfasst: Sa 17.11.12 09:04 
Hallo allerseits !

mit dem folgenden Quelltext markiere ich das gesamte Richedit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Procedure MarkInRichEdit(Const ATargetRichEdit: TRichEdit);
Begin
  ATargetRichEdit.SetFocus;
  ATargetRichEdit.SelStart := 0;
  ATargetRichEdit.SelLength := Length(ATargetRichedit.Text);
End{* Function *}



Procedure TFrmChild.MarkX(Sender: TObject);
Begin
  MarkInRichEdit(RichEdit1);
End{* Procedure *}


was muss ich tun, damit ich anschliessend zuoberst im Text bin und nicht zuunterst ?

Vielen Dank für die Hilfe !


Hochhaus
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Sa 17.11.12 12:14 
user profile iconHochhaus hat folgendes geschrieben Zum zitierten Posting springen:
was muss ich tun, damit ich anschliessend zuoberst im Text bin und nicht zuunterst ?


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TMainform.Button1Click(Sender: TObject);
begin
  RichEdit1.SelectAll;
  RichEdit1.SetFocus;
  RichEdit1.Perform(WM_VScroll, SB_Top, 0);
end;

Für diesen Beitrag haben gedankt: Hochhaus
Hochhaus Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 662
Erhaltene Danke: 8

Windows 7
Delphi XE2
BeitragVerfasst: Sa 17.11.12 13:12 
Danke !! Es funktioniert, ist aber bei grossen Dateien sehr langsam. Was könnte man tun, um es zu beschleunigen ?

Hochhaus
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Sa 17.11.12 15:57 
user profile iconHochhaus hat folgendes geschrieben Zum zitierten Posting springen:
Was könnte man tun, um es zu beschleunigen ?


Zum Selektieren nicht SelectAll verwenden, sondern Ctrl+A an das Fenster senden.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TMainform.Button1Click(Sender: TObject);
begin
  RichEdit1.SetFocus;

  // Ggf. zum Anfang des Dokumentes springen
  RichEdit1.SelStart := RichEdit1.Perform(EM_LineIndex, 00);
  RichEdit1.Perform(EM_ScrollCaret, 00);

  // Tastendruck Ctrl+A senden
  Keybd_Event(VK_Control, 000);
  Keybd_Event(VkKeyScan('A'), 000);
  Keybd_Event(VkKeyScan('A'), 0, KeyEventF_KeyUp, 0);
  Keybd_Event(VK_Control, 0, KeyEventF_KeyUp, 0);
end;

Für diesen Beitrag haben gedankt: Hochhaus
Hochhaus Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 662
Erhaltene Danke: 8

Windows 7
Delphi XE2
BeitragVerfasst: Sa 17.11.12 16:18 
Super ! Das ist die beste Lösung, die möglich ist ! Vielen Dank !


Hochhaus