Bonjour,
J'arrive à faire défiler 2 TMemos en //, en exploitant ces 2 pages

http://www.swissdelphicenter.ch/torr...de.php?id=2227
http://www.developpez.net/forums/d29...ox-evenements/

avec le scroll, c'est OK, mais avec la roulette souris, ou le line up/down de la scrollbar, ma scrollbar esclave va se mettre soit tout en haut, soit tout en bas. Le texte du TMemo esclave, lui, se positionne toujours bien.
Ça marche, et la scrollbar esclave se repositionne bien, dès que j'agis sur la scrollbar maitre. Donc, c'est quasi nickel, mais pas à 100%.

Apparement, d'après ce topic, il doit falloir définir la scrollrange esclave

http://www.developpez.net/forums/d47...eur-scrollbar/

Or, les 2 scrollbars ont bien la même range, puisque les 2 mémos ont le même fichier pour mes tests, et que cette range se définit au chargement du fichier test.

Donc, il y a un autre truc : faut pouvoir définir le thumb esclave, quand j'utilise la roulette souris, ou le line up/down, ce thumb étant défini implicitement quand je fais un scroll maitre.

Là, j'ai beau chercher, je trouve nada.

Voilà mon code (Memo1 en esclave) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
unit synchroScroll;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;        //SHDocVw
 
type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    Memo2: TMemo;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    PRichEdWndProc, POldWndProc: Pointer;
    procedure RichEdWndProc(var Msg: TMessage);
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.RichEdWndProc(var Msg: TMessage);
begin
  Msg.Result := CallWindowProc(POldWndProc, Memo2.Handle, Msg.Msg,
    Msg.wParam, Msg.lParam);
 
  if (Msg.Msg = WM_VSCROLL) then
    if (LOWORD(Msg.wParam) = SB_THUMBTRACK) or
        (LOWORD(Msg.wParam) = SB_LINEDOWN) or (LOWORD(Msg.wParam) = SB_LINEUP) or
        (LOWORD(Msg.wParam) = SB_PAGEDOWN) or (LOWORD(Msg.wParam) = SB_PAGEUP) then
  begin
    Label1.Caption := 'Pos is ' + IntToStr(HIWORD(Msg.wParam));
    Memo1.Perform(Msg.Msg, Msg.wParam, Msg.lParam);
    SetScrollPos(Memo1.Handle, SB_VERT, HIWORD(Msg.wParam), True);
  end;
  if (Msg.Msg = WM_Mousewheel)  then      //and (LOWORD(Msg.wParam) = SB_THUMBTRACK)
  begin
    Label1.Caption := 'Pos is ' + IntToStr(HIWORD(Msg.wParam));
    Memo1.Perform(Msg.Msg, Msg.wParam, Msg.lParam);
    SetScrollPos(Memo1.Handle, SB_VERT, HIWORD(Msg.wParam), True);
  end;
 
end;
 
 
procedure TForm1.FormCreate(Sender: TObject);
begin
 
  PRichEdWndProc := MakeObjectInstance(RichEdWndProc);
  POldWndProc    := Pointer(SetWindowLong(Memo2.Handle, GWL_WNDPROC,
    Integer(PRichEdWndProc)));
 
  Memo1.Lines.LoadFromFile('fictest.cvs');
  Memo2.Lines.LoadFromFile('fictest.cvs');
 
end;
 
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if Assigned(PRichEdWndProc) then
  begin
    SetWindowLong(Memo2.Handle, GWL_WNDPROC, Integer(POldWndProc));
    FreeObjectInstance(PRichEdWndProc);
  end;
end;
 
end.
Merci d'avance pour vos infos