Scroller

Makes window scrollable.

Dependencies

Win 1.22

Summary
ScrollerMakes window scrollable.
InitInitialization function.
UpdateBarsUpdates horizontal and/or vertical scroll bar.
About

Init

Scroller_Init()

Initialization function.  Must not be used with scrollable Panel.

UpdateBars

Scroller_UpdateBars(Hwnd,  
Bars = 3,
MX = 0,
MY = 0)

Updates horizontal and/or vertical scroll bar.

Parameters

HwndWindow that contains system created scrollbars.
BarsSet to 1 to update only horizontal bar, 2 updates only vertical bar, 3 (default) updates both.
MX, MYSet here x & y margin of your window.  By default 0.

Remarks

The function will make scrollbars visible only if needed.  You don’t need to have scroll styles on window prior to calling it.  You need to call this function after adding new controls to the GUI and after resizing window.  If used with resizable window, its enough to put call to this function in GuiSize routine (this might not work in same cases of GUI creation).  In any case, you need to update scrollbars after adding new controls to the GUI.  Scroller replaces message handlers for WM_VSCROLL & WM_HSCROLL messages at the moment which will influence ScrollBar control if you have it (or vice-versa), i.e. message stacking is not done as its not very probable that you will use those 2 modules together.

You can change the position of the vertical scrollbars by setting WS_EX_LEFTSCROLLBAR=0x4000.  For more control over scrollbars you need to use ScrollBar control.

If you use Attach function, you may experience some miscalculation of scrollable area (not happening if Panel is the host).  This is due to the fact that attached controls may be resized as a consequence of window resizing (WM_SIZE message is sent when scrollbars are added and it will trigger Attach handler) and module doesn’t take that change into account.  Calling this function 3 times in a row fixes the problem.  You cant use Attach’s p option (proportional) with Scroller (known bug).

I discovered that SkinSharp when used in AHK app via its dll could cause Scroller missbehavior when used together with Attach.

About

Scroller_Init()
Initialization function.
Scroller_UpdateBars(Hwnd,  
Bars = 3,
MX = 0,
MY = 0)
Updates horizontal and/or vertical scroll bar.
Set of window functions.
Control container.
Scroll Bar control.
Attach(hCtrl = "",
aDef = "")
Determines how a control is resized with its parent.
Close