Autor Beitrag
ardely
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66



BeitragVerfasst: Fr 22.02.13 11:38 
Guten Tag,

Ist es möglich mit dem vertikal scrollbar eines richedit das vertikal scrollbar eines scrollbox zu steuern

Ich habe so etwas ausprobiert und es funktioniert auch:

ausblenden Delphi-Quelltext
1:
scrollbox1.VertScrollBar.Position := GetScrollPos(RichEdit1.Handle, SB_VERT);					


Aber wenn ich das vertikal scrolbar wegnehme, funktioniert das Scrolling nicht mehr!

ausblenden Delphi-Quelltext
1:
scrollbox1.VertScrollBar.visible := False;					


Gibt es eine Möglichkeit wie man über das richedit vertikal scrollbar das scrollbox steuern kann?
Sehr vielen Dank für Ihre Hilfe.

Grüss
WasWeißDennIch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 653
Erhaltene Danke: 160



BeitragVerfasst: Fr 22.02.13 11:44 
Aus der Hüfte geschossen: ScrollBy
ardely Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66



BeitragVerfasst: Fr 22.02.13 13:00 
Hallo,

Wie kann ich am richedit beim Anklicken des vertikal scrollbar nach oben oder nach unten herausfinden, sodass ich das wert am ScrollBy() weiter geben kann !
z.b wie OnScroll.

Danke
ardely Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66



BeitragVerfasst: Mo 25.02.13 12:03 
Guten Tage
Ich habe ein procedure gefunden, wo man die Scrollposition (scrollbar Bewegung) mit WM VSCROLL abfangen kann.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.RichEdWndProc(var Msg: TMessage);
begin
  Msg.Result := CallWindowProc(POldWndProc, RichEdit1.Handle, Msg.Msg, Msg.WParam,
    Msg.LParam);

  if (Msg.Msg = WM_VSCROLL)  then
  begin
    Label1.Caption := 'scrollbar move' + IntToStr(HIWORD(Msg.Wparam));
    RichEdit1.SelStart := RichEdit1.Perform(EM_LINEINDEX,
      RichEdit1.Perform(EM_GETFIRSTVISIBLELINE, 00), 0) + 1;
  end;
end;


Ich möchte ebenfalls in dieser procedure auch die Pfeiltaste up/ down (und Mouse wheel up/down) abfangen, z.b wie

ausblenden Delphi-Quelltext
1:
if (Msg.Msg = WM_Pfeil_Down ???? ) then  ...					


Ist das möglich, wenn ja, würde ich sehr dankbar für ein kleines Beispiel.
Grüß und danke im voraus.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mo 25.02.13 14:33 
Meinst Du so etwas?

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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TRichEdit=Class(ComCtrls.TRichEdit)

  private
    procedure WndProc(var Msg: TMessage);override;
  End;
  TForm1 = class(TForm)
    RichEdit1: TRichEdit;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure TRichEdit.WndProc(var Msg: TMessage);
begin

  if (Msg.Msg =  WM_VSCROLL)
  or ((Msg.Msg = WM_KeyDown) and (Msg.WParam in [VK_Down,VK_UP]))
  or (msg.Msg =  WM_MouseWheel)
  then
  begin
     msg.Result := 0;
  end
  else inherited;
end;

end.


gegf. übersteuern über Tag o.ä. um es bedingt zum Scrollen zu bekommen

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
ardely Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 66



BeitragVerfasst: Mo 25.02.13 15:35 
Sehr vielen Dank, jetzt kann ich endlich weiter gehen mit deiner Hilfe (habe lange gesucht!).
Ich danke dir nochmal bummi.
Grüße