sScrollbox on an sFrameBar

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #47323
    Support
    Keymaster

      Hello

      Maybe this is standard behavior?

      Can you check the TSrollBox component please?

      Here I uploaded the test-app by your problem description. It's correct?

      #47233
      mol
      Participant

        Yes, your test application shows the behaviour I was experiencing. In the meantime, I have found an old solution posted by Peter Below for a related problem:

        Quote:

        “The main problem seems to be that the scrollbox does not take focus when clicked on, and the MS Intellimouse driver will only send WM_MOUSEWHEEL messages to the control with focus. So the messages go to the form.”

        procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState;

        WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);

        begin

        if PtInRect(scrollbox1.BoundsRect, ScreenToClient(Mouse.CursorPos)) then

        scrollbox1MouseWheel(Sender, Shift, WheelDelta, MousePos, Handled);

        end;

        procedure TForm1.scrollbox1MouseWheel(Sender: TObject;

        Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;

        var Handled: Boolean);

        var

        msg: Cardinal;

        code: Cardinal;

        i, n: Integer;

        begin

        Handled := true;

        if ssShift in Shift then

        msg := WM_HSCROLL

        else

        msg := WM_VSCROLL;

        if WheelDelta > 0 then

        code := SB_LINEUP

        else

        code := SB_LINEDOWN;

        n:= Mouse.WheelScrollLines;

        for i:= 1 to n do

        scrollbox1.Perform(msg, code, 0);

        scrollbox1.Perform(msg, SB_ENDSCROLL, 0);

        end;

        The above works with a regular scrollbox, but I haven't checked with the sScrollBox. Anyway, I hope this helps others in the future.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.