i created a custom Rich which has a scrollPos event.
so i have this code:
procedure TCustomRich.WMVScroll(var Msg : TWMVScroll);
begin
inherited;
if (Msg.ScrollCode in [SB_THUMBTRACK, SB_THUMBPOSITION]) then
FScrollY := Msg.Pos;
if Assigned(OnScroll) then
OnScroll(Self, FScrollX, FScrollY);
end;
procedure TCustomRich.WMHScroll(var Msg : TWMVScroll);
begin
inherited;
if (Msg.ScrollCode in [SB_THUMBTRACK, SB_THUMBPOSITION]) then
FScrollX := Msg.Pos;
if Assigned(OnScroll) then
OnScroll(Self, FScrollX, FScrollY);
end;
but the problem is it wont trigger when it scroll using the keys or mouse wheels.
TRichEditcan be an awkward customer in this regard. You need to handle the EN_VSCROLL and EN_HSCROLL notification messages in conjunction with the WM_VSCROLL and WM_HSCROLL messages.I found a C++ Builder article that shows what is needed: http://bcbjournal.com/bcbcaq/?loc=edits&caq=29