• Hello,

    I use WPTools 4.25.
    I want to hook external Scrollbars to WPRich text components, but they are windows native and I can't hook them directly to WPRichtext. Is there any event in RichText component that is fired when scrolling (Mosewheel, line down, page down) that I can use to programaticaly implement scrolling?

    Thanks

  • Hi Julian,

    Since there is no such an event, I tried to hook standard delphi scrollbar to Richtext component and to use its event for scrolling with 3rd party scrollbar and this can work except... I set property visible of standard scrollbar to false, because I want to see only 3rd party scroll, but still this standard scrollbar is visible. Is there possibility not to force visible property of hooked external scroolbar in rich text?

    Thanks

  • Yes, it didn't help, but I found in WPRichText.pas in function TWPCustomRichText.DoSetVScrollRange line
    FVScroll.Visible := TRUE;
    When I comment this line, it is OK, external scrollbar is not vissible but I still can use its events !

    Thanks anyway

  • Zitat von wpsupport

    Hi,

    ok, now also I understand - you use the external scrollbar to just get the events. Should work but I would rather use the WMSCroll messages.

    Julian

    Exactly what message do I have to intercept?

    I tried WM_HSCROLL, WM_VSCROLL but they do not work.

    Obviously it is some internal message, but how to find it?

  • Alright, I fixed the problem

    this is what I did

    Code
    TVerticalScrollEvent = procedure(Sender: TObject) of object;TWPRichTextDezta = class(TWPRichText)  private     FOnVerticalScrollEvent: TNotifyEvent;     procedure OnVerticalScoll(var msg: TMessage); message WM_VSCROLL;  published      property OnVerticalScrollEvent: TNotifyEvent read FOnVerticalScrollEvent write FOnVerticalScrollEvent;end;implementationprocedure TWPRichTextDezta.OnVerticalScoll(var msg: TMessage);begin  if Assigned(FOnVerticalScrollEvent) then    FOnVerticalScrollEvent(Self);  inherited;end;

    Now I can hook the event to a procedure dynamicly using

    Code
    Editor.OnVerticalScrollEvent := ScrollBarChange;
    
    
    procedure TMainForm.ScrollBarChange(Sender: TObject);
    begin
      // my code
    end;