Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi OnScroll wird nicht ausgelöst (Komponente) (https://www.delphipraxis.net/185978-onscroll-wird-nicht-ausgeloest-komponente.html)

Captnemo 23. Jul 2015 12:55

OnScroll wird nicht ausgelöst (Komponente)
 
Hi,

ich steh irgendwie auf dem Schlauch. Ich schreib mir grad ein erweitertes TListView und will zwei OnScroll-Ereignisse hinzufügen:

Delphi-Quellcode:
 TNewListView=class(Vcl.ComCtrls.TListView)
  private
    FHScrollEvent: TNotifyEvent;
    FVScrollEvent: TNotifyEvent;
  protected
    procedure WMVScroll(var message: TWMVScroll); message WM_VSCROLL;
    procedure WMHScroll(var message: TWMHScroll); message WM_HSCROLL;
  published
    property OnVertScroll: TNotifyEvent read FVScrollEvent write FVScrollEvent;
    property OnHorScroll: TNotifyEvent read FHScrollEvent write FHScrollEvent;
  end;

implementation

procedure TNewListView.WMHScroll(var message: TWMHScroll);
begin
  if Assigned(FHScrollEvent) then
    FHScrollEvent(Self);
  inherited;
end;

procedure TNewListView.WMVScroll(var message: TWMVScroll);
begin
  if Assigned(FVScrollEvent) then
    FVScrollEvent(Self);
  inherited;
end;
Nur werden meine Ereignisse nie ausgelöst. Was habe ich vergessen?

Union 23. Jul 2015 13:07

AW: OnScroll wird nicht ausgelöst (Komponente)
 
Du hast vergessen dass diese Methoden private sind. Verwende lieber subclassing und tausche den generellen Eventhandler WindowProc aus.

Captnemo 24. Jul 2015 09:43

AW: OnScroll wird nicht ausgelöst (Komponente)
 
Danke ;) Das hat funktioniert.


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz