Bonjour,

j'ai utilisé cela pour intercepter dans une stringgrid le click sur la fleche haute ou basse.
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
unit Plan;
 
interface
 
uses
	Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
	Grids, StdCtrls,extctrls, AppEvent, RxGrdCpt;
 
type
	Planning=class(TStringGrid)
	protected
 
	end;
TForm1 = class(TForm)
	Planning: TStringGrid;
	procedure WMVSCROLL(var Message :TMessage); message WM_VSCROLL;
	procedure FormCreate(Sender: TObject);
	procedure PlanningTopLeftChanged(Sender: TObject);
	procedure AfficheRec(Grid:TstringGrid);
private
	{ Déclarations privées }
 
public
	{ Déclarations publiques }
 
end;
 
var
  Form1: TForm1;
  OldWindowProcPlanning: TWndMethod;
 
implementation
 
procedure TForm1.FormCreate(Sender: TObject);
var x:integer;
begin
  OldWindowProcPlanning := Planning.WindowProc;  // Affecte une nouvelle procédure de fenêtre.
  Planning.WindowProc := WMVSCROLL;  //
....
end;
 
procedure TForm1.WMVSCROLL(Var message:Tmessage);
begin
  if (message.msg=SB_LINEUP) then
     showMessage('up');
  if (message.msg=SB_LINEDOWN) then
     showMessage('Down');
  OldWindowProcPlanning(message);
end;
Le programme afiche Down au lancement, puis lorsque je clique sur l'une ou l'autre des fléches du StringGrid, rien ne se passe.

je pense que la ligne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
OldWindowProcPlanning(message);
de la proc WMVSCROLL annule le message une fois qu'il a été intercepter.
comment faire pour intercepter le scroll haut et bas dans ma stringgrid?
A+