Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SevenKeyboard/scrollable-gui

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

109 Commits
109 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScrollableGui

This class provides scrollable Gui functionality for AutoHotkey v1 and v2, with dynamic scroll range updates.
It supports horizontal and vertical scrolling, mouse wheel scrolling, and resize-aware behavior.
It also provides optional focus-aware wheel routing for common controls (Edit/UpDown, ComboBox, etc.).

For version-specific integration code, see the main-ahkv1 and main-ahkv2 branches of this repository.
For runnable examples, see the examples/ folder.

Example 1 – scrollable window and inner controls


Features

  • Vertical + horizontal scrollbars
  • Mouse wheel scrolling
    • Shift + Wheel → horizontal scroll (common Windows UX)
    • Optional focus-aware wheel routing for common controls
  • Resize-aware updates
    • Recalculates scroll ranges/pages during sizing
    • Scrolls window contents to match the new scroll positions
  • Helpers
    • Calculate the bounding rectangle of child controls
    • Update the stored content boundary and optionally apply GUI MaxSize

Requirements

  • AutoHotkey v2.0.0+ (for the v2 branch)
  • AutoHotkey v1.1.35+ (for the v1 branch)

Installation

  1. Copy ScrollableGui.ahk into your project (or add this repository as a submodule).
  2. #Include it.
  3. Call ScrollableGui.init() once (global message hooks).
  4. Register a GUI window with ScrollableGui.register().

Public API (shared concept; see each branch for exact signatures)

ScrollableGui.init()

Registers internal message handlers (WM_VSCROLL, WM_HSCROLL, WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_SIZING, etc.).
Call once per script.

ScrollableGui.register(hWndOrGui, innerScrollOnFocus := true) -> true/false

Registers a window as scrollable.

  • innerScrollOnFocus (default true): when focus is inside a child control, wheel input may be routed to that control when appropriate.

ScrollableGui.unregister(hWndOrGui) -> true/false

Stops managing the window.
If ScrollableGui.init() is active (it hooks WM_DESTROY), the window is automatically unregistered when it is destroyed—so an explicit call is usually unnecessary.

ScrollableGui.isRegistered(hWndOrGui) -> true/false

Returns whether the window is registered.

ScrollableGui.enableInnerScrollOnFocus(hWndOrGui, onOff := true)

Toggles focus-based wheel routing after registration.

ScrollableGui.syncSize(hWndOrGui) -> true/false

Forces recalculation of scroll ranges/pages using current window size and stored boundary.

ScrollableGui.calculateInnerControlsSize(hWndOrGui, &left?, &top?, &right?, &bottom?, visibleControlsOnly := true) -> true/false

Computes the bounding rectangle of child controls.

ScrollableGui.getBoundary(hWndOrGui, &width?, &height?) -> true/false

Returns the stored content boundary size.

ScrollableGui.updateBoundary(hWndOrGui, newWidth?, newHeight?, setMaxSize := true) -> true/false

Updates stored boundary (content size), then calls syncSize().
Optionally applies MaxSize to clamp resizing.


Background / Related Threads

This project started as a response to a forum question/request:

Project threads:


Credits

Special thanks to Lexikos. Without the original forum post
Scrollable GUI - Proof of Concept,
this project would not have been possible to begin in the first place.


License

MIT License

About

Enables a window to scroll its contents with scrollbars, mouse wheel, and resize-aware behavior.

Resources

License

Stars

Watchers

Forks

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.